File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 5
5
use Closure ;
6
6
use MongoDB \BSON \Javascript ;
7
7
use MongoDB \Collection ;
8
+ use MongoDB \Database ;
8
9
use MongoDB \Driver \BulkWrite ;
9
10
use MongoDB \Driver \ReadConcern ;
10
11
use MongoDB \Driver \ReadPreference ;
@@ -352,8 +353,9 @@ public function testRenameToSameDatabase(): void
352
353
353
354
public function testRenameToDifferentDatabase (): void
354
355
{
355
- $ toCollectionName = $ this ->getCollectionName () . '.renamed ' ;
356
356
$ toDatabaseName = $ this ->getDatabaseName () . '_renamed ' ;
357
+ $ toCollectionName = $ this ->getCollectionName () . '.renamed ' ;
358
+ $ toDatabase = new Database ($ this ->manager , $ toDatabaseName );
357
359
$ toCollection = new Collection ($ this ->manager , $ toDatabaseName , $ toCollectionName );
358
360
359
361
$ writeResult = $ this ->collection ->insertOne (['_id ' => 1 ]);
@@ -366,7 +368,9 @@ public function testRenameToDifferentDatabase(): void
366
368
367
369
$ document = $ toCollection ->findOne ();
368
370
$ this ->assertSameDocument (['_id ' => 1 ], $ document );
371
+
369
372
$ toCollection ->drop ();
373
+ $ toDatabase ->drop ();
370
374
}
371
375
372
376
public function testWithOptionsInheritsOptions (): void
Original file line number Diff line number Diff line change @@ -240,8 +240,9 @@ public function testRenameCollectionToSameDatabase(): void
240
240
241
241
public function testRenameCollectionToDifferentDatabase (): void
242
242
{
243
- $ toCollectionName = $ this ->getCollectionName () . '.renamed ' ;
244
243
$ toDatabaseName = $ this ->getDatabaseName () . '_renamed ' ;
244
+ $ toCollectionName = $ this ->getCollectionName () . '.renamed ' ;
245
+ $ toDatabase = new Database ($ this ->manager , $ toDatabaseName );
245
246
$ toCollection = new Collection ($ this ->manager , $ toDatabaseName , $ toCollectionName );
246
247
247
248
$ bulkWrite = new BulkWrite ();
@@ -262,7 +263,9 @@ public function testRenameCollectionToDifferentDatabase(): void
262
263
263
264
$ document = $ toCollection ->findOne ();
264
265
$ this ->assertSameDocument (['_id ' => 1 ], $ document );
266
+
265
267
$ toCollection ->drop ();
268
+ $ toDatabase ->drop ();
266
269
}
267
270
268
271
public function testSelectCollectionInheritsOptions (): void
You can’t perform that action at this time.
0 commit comments