Skip to content

Commit 7667f7f

Browse files
committed
Removing all collections is enough to drop the database
1 parent bef00b3 commit 7667f7f

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

tests/FunctionalTestCase.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -306,15 +306,8 @@ protected function dropCollection(?string $databaseName = null, ?string $collect
306306
protected function cleanupCollections(): void
307307
{
308308
foreach ($this->collectionsToCleanup as $databaseName => $collectionNames) {
309-
// The default database is never dropped.
310-
if ($databaseName === $this->getDatabaseName()) {
311-
foreach ($collectionNames as $collectionName => $unused) {
312-
$this->dropCollection($databaseName, $collectionName);
313-
}
314-
} else {
315-
$options = ['writeConcern' => new WriteConcern(WriteConcern::MAJORITY)];
316-
$operation = new DropDatabase($databaseName, $options);
317-
$operation->execute($this->getPrimaryServer());
309+
foreach ($collectionNames as $collectionName => $unused) {
310+
$this->dropCollection($databaseName, $collectionName);
318311
}
319312
}
320313

0 commit comments

Comments
 (0)