Skip to content

Commit 5f09883

Browse files
committed
Simplify arguments for assertCollectionDoesNotExist()
1 parent a2715b1 commit 5f09883

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

tests/Operation/DropCollectionFunctionalTest.php

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace MongoDB\Tests\Operation;
44

5-
use MongoDB\Driver\Server;
65
use MongoDB\Operation\DropCollection;
76
use MongoDB\Operation\InsertOne;
87
use MongoDB\Operation\ListCollections;
@@ -20,34 +19,30 @@ public function testDropExistingCollection()
2019
$operation = new DropCollection($this->getDatabaseName(), $this->getCollectionName());
2120
$operation->execute($server);
2221

23-
$this->assertCollectionDoesNotExist($server, $this->getDatabaseName(), $this->getCollectionName());
22+
$this->assertCollectionDoesNotExist($this->getCollectionName());
2423
}
2524

2625
/**
2726
* @depends testDropExistingCollection
2827
*/
2928
public function testDropNonexistentCollection()
3029
{
31-
$server = $this->getPrimaryServer();
32-
33-
$this->assertCollectionDoesNotExist($server, $this->getDatabaseName(), $this->getCollectionName());
30+
$this->assertCollectionDoesNotExist($this->getCollectionName());
3431

3532
$operation = new DropCollection($this->getDatabaseName(), $this->getCollectionName());
36-
$operation->execute($server);
33+
$operation->execute($this->getPrimaryServer());
3734
}
3835

3936
/**
4037
* Asserts that a collection with the given name does not exist on the
4138
* server.
4239
*
43-
* @param Server $server
44-
* @param string $databaseName
4540
* @param string $collectionName
4641
*/
47-
private function assertCollectionDoesNotExist(Server $server, $databaseName, $collectionName)
42+
private function assertCollectionDoesNotExist($collectionName)
4843
{
49-
$operation = new ListCollections($databaseName);
50-
$collections = $operation->execute($server);
44+
$operation = new ListCollections($this->getDatabaseName());
45+
$collections = $operation->execute($this->getPrimaryServer());
5146

5247
$foundCollection = null;
5348

@@ -58,6 +53,6 @@ private function assertCollectionDoesNotExist(Server $server, $databaseName, $co
5853
}
5954
}
6055

61-
$this->assertNull($foundCollection, sprintf('Collection %s exists on the server', $collectionName));
56+
$this->assertNull($foundCollection, sprintf('Collection %s exists', $collectionName));
6257
}
6358
}

0 commit comments

Comments
 (0)