Skip to content

Commit 83bd963

Browse files
committed
More attributes updates
1 parent 82a7b65 commit 83bd963

File tree

3 files changed

+24
-39
lines changed

3 files changed

+24
-39
lines changed

tests/GridFS/FunctionalTestCase.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
use MongoDB\GridFS\Bucket;
77
use MongoDB\Operation\DropCollection;
88
use MongoDB\Tests\FunctionalTestCase as BaseFunctionalTestCase;
9+
use PHPUnit\Framework\Attributes\AfterClass;
10+
use PHPUnit\Framework\Attributes\BeforeClass;
911

1012
use function fopen;
1113
use function fwrite;
@@ -46,10 +48,9 @@ public function tearDown(): void
4648
* The bucket's collections are created by the first test that runs and
4749
* kept for all subsequent tests. This is done to avoid creating the
4850
* collections and their indexes for each test, which would be slow.
49-
*
50-
* @beforeClass
51-
* @afterClass
5251
*/
52+
#[BeforeClass]
53+
#[AfterClass]
5354
public static function dropCollectionsBeforeAfterClass(): void
5455
{
5556
$manager = static::createTestManager();

tests/SpecTests/ClientSideEncryption/Prose22_RangeExplicitEncryptionTest.php

Lines changed: 20 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
use MongoDB\Driver\ClientEncryption;
1717
use MongoDB\Driver\Exception\EncryptionException;
1818
use MultipleIterator;
19+
use PHPUnit\Framework\Attributes\DataProvider;
20+
use PHPUnit\Framework\Attributes\Group;
1921

2022
use function base64_decode;
2123
use function file_get_contents;
@@ -26,9 +28,9 @@
2628
* Prose test 22: Range Explicit Encryption
2729
*
2830
* @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#22-range-explicit-encryption
29-
* @group csfle
30-
* @group serverless
3131
*/
32+
#[Group('csfle')]
33+
#[Group('serverless')]
3234
class Prose22_RangeExplicitEncryptionTest extends FunctionalTestCase
3335
{
3436
private ?ClientEncryption $clientEncryption = null;
@@ -178,10 +180,8 @@ public static function provideTypeAndRangeOpts(): Generator
178180
];
179181
}
180182

181-
/**
182-
* @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-1-can-decrypt-a-payload
183-
* @dataProvider provideTypeAndRangeOpts
184-
*/
183+
/** @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-1-can-decrypt-a-payload */
184+
#[DataProvider('provideTypeAndRangeOpts')]
185185
public function testCase1_CanDecryptAPayload(string $type, array $rangeOpts): void
186186
{
187187
$this->setUpWithTypeAndRangeOpts($type, $rangeOpts);
@@ -211,10 +211,8 @@ public function testCase1_CanDecryptAPayload(string $type, array $rangeOpts): vo
211211
$this->assertEquals($originalValue, $decryptedValue);
212212
}
213213

214-
/**
215-
* @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-2-can-find-encrypted-range-and-return-the-maximum
216-
* @dataProvider provideTypeAndRangeOpts
217-
*/
214+
/** @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-2-can-find-encrypted-range-and-return-the-maximum */
215+
#[DataProvider('provideTypeAndRangeOpts')]
218216
public function testCase2_CanFindEncryptedRangeAndReturnTheMaximum(string $type, array $rangeOpts): void
219217
{
220218
$this->setUpWithTypeAndRangeOpts($type, $rangeOpts);
@@ -248,10 +246,8 @@ public function testCase2_CanFindEncryptedRangeAndReturnTheMaximum(string $type,
248246
$this->assertMultipleDocumentsMatch($expectedDocuments, $cursor);
249247
}
250248

251-
/**
252-
* @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-3-can-find-encrypted-range-and-return-the-minimum
253-
* @dataProvider provideTypeAndRangeOpts
254-
*/
249+
/** @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-3-can-find-encrypted-range-and-return-the-minimum */
250+
#[DataProvider('provideTypeAndRangeOpts')]
255251
public function testCase3_CanFindEncryptedRangeAndReturnTheMinimum(string $type, array $rangeOpts): void
256252
{
257253
$this->setUpWithTypeAndRangeOpts($type, $rangeOpts);
@@ -284,10 +280,8 @@ public function testCase3_CanFindEncryptedRangeAndReturnTheMinimum(string $type,
284280
$this->assertMultipleDocumentsMatch($expectedDocuments, $cursor);
285281
}
286282

287-
/**
288-
* @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-4-can-find-encrypted-range-with-an-open-range-query
289-
* @dataProvider provideTypeAndRangeOpts
290-
*/
283+
/** @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-4-can-find-encrypted-range-with-an-open-range-query */
284+
#[DataProvider('provideTypeAndRangeOpts')]
291285
public function testCase4_CanFindEncryptedRangeWithAnOpenRangeQuery(string $type, array $rangeOpts): void
292286
{
293287
$this->setUpWithTypeAndRangeOpts($type, $rangeOpts);
@@ -311,10 +305,8 @@ public function testCase4_CanFindEncryptedRangeWithAnOpenRangeQuery(string $type
311305
$this->assertMultipleDocumentsMatch($expectedDocuments, $cursor);
312306
}
313307

314-
/**
315-
* @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-5-can-run-an-aggregation-expression-inside-expr
316-
* @dataProvider provideTypeAndRangeOpts
317-
*/
308+
/** @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-5-can-run-an-aggregation-expression-inside-expr */
309+
#[DataProvider('provideTypeAndRangeOpts')]
318310
public function testCase5_CanRunAnAggregationExpressionInsideExpr(string $type, array $rangeOpts): void
319311
{
320312
$this->setUpWithTypeAndRangeOpts($type, $rangeOpts);
@@ -343,10 +335,8 @@ public function testCase5_CanRunAnAggregationExpressionInsideExpr(string $type,
343335
$this->assertMultipleDocumentsMatch($expectedDocuments, $cursor);
344336
}
345337

346-
/**
347-
* @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-6-encrypting-a-document-greater-than-the-maximum-errors
348-
* @dataProvider provideTypeAndRangeOpts
349-
*/
338+
/** @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-6-encrypting-a-document-greater-than-the-maximum-errors */
339+
#[DataProvider('provideTypeAndRangeOpts')]
350340
public function testCase6_EncryptingADocumentGreaterThanTheMaximumErrors(string $type, array $rangeOpts): void
351341
{
352342
if ($type === 'DecimalNoPrecision' || $type === 'DoubleNoPrecision') {
@@ -367,10 +357,8 @@ public function testCase6_EncryptingADocumentGreaterThanTheMaximumErrors(string
367357
$this->clientEncryption->encrypt(self::cast($type, 201), $encryptOpts);
368358
}
369359

370-
/**
371-
* @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-7-encrypting-a-value-of-a-different-type-errors
372-
* @dataProvider provideTypeAndRangeOpts
373-
*/
360+
/** @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-7-encrypting-a-value-of-a-different-type-errors */
361+
#[DataProvider('provideTypeAndRangeOpts')]
374362
public function testCase7_EncryptingAValueOfADifferentTypeErrors(string $type, array $rangeOpts): void
375363
{
376364
if ($type === 'DecimalNoPrecision' || $type === 'DoubleNoPrecision') {
@@ -395,10 +383,8 @@ public function testCase7_EncryptingAValueOfADifferentTypeErrors(string $type, a
395383
$this->clientEncryption->encrypt($value, $encryptOpts);
396384
}
397385

398-
/**
399-
* @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-8-setting-precision-errors-if-the-type-is-not-double-or-decimal128
400-
* @dataProvider provideTypeAndRangeOpts
401-
*/
386+
/** @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/tests/README.md#case-8-setting-precision-errors-if-the-type-is-not-double-or-decimal128 */
387+
#[DataProvider('provideTypeAndRangeOpts')]
402388
public function testCase8_SettingPrecisionErrorsIfTheTypeIsNotDoubleOrDecimal128(string $type, array $rangeOpts): void
403389
{
404390
if ($type === 'DecimalNoPrecision' || $type === 'DecimalPrecision' || $type === 'DoubleNoPrecision' || $type === 'DoublePrecision') {

tests/TestCase.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
use MongoDB\BSON\Document;
77
use MongoDB\BSON\PackedArray;
88
use MongoDB\Codec\Codec;
9-
use MongoDB\Codec\DecodeIfSupported;
10-
use MongoDB\Codec\EncodeIfSupported;
119
use MongoDB\Driver\ReadConcern;
1210
use MongoDB\Driver\ReadPreference;
1311
use MongoDB\Driver\WriteConcern;

0 commit comments

Comments
 (0)