@@ -54,7 +54,7 @@ abstract class FunctionalTestCase extends TestCase
54
54
/** @var array */
55
55
private $ configuredFailPoints = [];
56
56
57
- /** @var Collection[] */
57
+ /** @var array{int,{ Collection,array}} */
58
58
private $ collectionsToCleanup = [];
59
59
60
60
public function setUp (): void
@@ -271,6 +271,10 @@ protected function createCollection(string $databaseName, string $collectionName
271
271
{
272
272
$ collection = $ this ->dropCollection ($ databaseName , $ collectionName , $ options );
273
273
274
+ if (isset ($ options ['encryptedFields ' ])) {
275
+ throw new InvalidArgumentException ('The "encryptedFields" option is not supported by createCollection(). Time to refactor! ' );
276
+ }
277
+
274
278
$ operation = new CreateCollection ($ databaseName , $ collectionName , $ options );
275
279
$ operation ->execute ($ this ->getPrimaryServer ());
276
280
@@ -288,16 +292,17 @@ protected function dropCollection(string $databaseName, string $collectionName,
288
292
{
289
293
$ options += ['writeConcern ' => new WriteConcern (WriteConcern::MAJORITY )];
290
294
$ collection = new Collection ($ this ->manager , $ databaseName , $ collectionName , $ options );
291
- $ this ->collectionsToCleanup [] = $ collection ;
292
295
$ collection ->drop ();
293
296
297
+ $ this ->collectionsToCleanup [] = [$ collection , $ options ];
298
+
294
299
return $ collection ;
295
300
}
296
301
297
302
private function cleanupCollections (): void
298
303
{
299
- foreach ($ this ->collectionsToCleanup as $ collection ) {
300
- $ collection ->drop ();
304
+ foreach ($ this ->collectionsToCleanup as [ $ collection, $ options ] ) {
305
+ $ collection ->drop ($ options );
301
306
}
302
307
303
308
$ this ->collectionsToCleanup = [];
0 commit comments