Skip to content

Commit 27e11e5

Browse files
committed
PHPLIB-682: Add test for Database::dropCollection()
1 parent 9e6e0cc commit 27e11e5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/Database/DatabaseFunctionalTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,19 @@ public function testDrop(): void
158158
$this->assertCollectionCount($this->getNamespace(), 0);
159159
}
160160

161+
public function testDropCollection(): void
162+
{
163+
$bulkWrite = new BulkWrite();
164+
$bulkWrite->insert(['x' => 1]);
165+
166+
$writeResult = $this->manager->executeBulkWrite($this->getNamespace(), $bulkWrite);
167+
$this->assertEquals(1, $writeResult->getInsertedCount());
168+
169+
$commandResult = $this->database->dropCollection($this->getCollectionName());
170+
$this->assertCommandSucceeded($commandResult);
171+
$this->assertCollectionCount($this->getNamespace(), 0);
172+
}
173+
161174
public function testGetSelectsCollectionAndInheritsOptions(): void
162175
{
163176
$databaseOptions = ['writeConcern' => new WriteConcern(WriteConcern::MAJORITY)];

0 commit comments

Comments
 (0)