Commit 5f09883d authored by Jeremy Mikola's avatar Jeremy Mikola

Simplify arguments for assertCollectionDoesNotExist()

parent a2715b13
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
namespace MongoDB\Tests\Operation; namespace MongoDB\Tests\Operation;
use MongoDB\Driver\Server;
use MongoDB\Operation\DropCollection; use MongoDB\Operation\DropCollection;
use MongoDB\Operation\InsertOne; use MongoDB\Operation\InsertOne;
use MongoDB\Operation\ListCollections; use MongoDB\Operation\ListCollections;
...@@ -20,7 +19,7 @@ class DropCollectionFunctionalTest extends FunctionalTestCase ...@@ -20,7 +19,7 @@ class DropCollectionFunctionalTest extends FunctionalTestCase
$operation = new DropCollection($this->getDatabaseName(), $this->getCollectionName()); $operation = new DropCollection($this->getDatabaseName(), $this->getCollectionName());
$operation->execute($server); $operation->execute($server);
$this->assertCollectionDoesNotExist($server, $this->getDatabaseName(), $this->getCollectionName()); $this->assertCollectionDoesNotExist($this->getCollectionName());
} }
/** /**
...@@ -28,26 +27,22 @@ class DropCollectionFunctionalTest extends FunctionalTestCase ...@@ -28,26 +27,22 @@ class DropCollectionFunctionalTest extends FunctionalTestCase
*/ */
public function testDropNonexistentCollection() public function testDropNonexistentCollection()
{ {
$server = $this->getPrimaryServer(); $this->assertCollectionDoesNotExist($this->getCollectionName());
$this->assertCollectionDoesNotExist($server, $this->getDatabaseName(), $this->getCollectionName());
$operation = new DropCollection($this->getDatabaseName(), $this->getCollectionName()); $operation = new DropCollection($this->getDatabaseName(), $this->getCollectionName());
$operation->execute($server); $operation->execute($this->getPrimaryServer());
} }
/** /**
* Asserts that a collection with the given name does not exist on the * Asserts that a collection with the given name does not exist on the
* server. * server.
* *
* @param Server $server
* @param string $databaseName
* @param string $collectionName * @param string $collectionName
*/ */
private function assertCollectionDoesNotExist(Server $server, $databaseName, $collectionName) private function assertCollectionDoesNotExist($collectionName)
{ {
$operation = new ListCollections($databaseName); $operation = new ListCollections($this->getDatabaseName());
$collections = $operation->execute($server); $collections = $operation->execute($this->getPrimaryServer());
$foundCollection = null; $foundCollection = null;
...@@ -58,6 +53,6 @@ class DropCollectionFunctionalTest extends FunctionalTestCase ...@@ -58,6 +53,6 @@ class DropCollectionFunctionalTest extends FunctionalTestCase
} }
} }
$this->assertNull($foundCollection, sprintf('Collection %s exists on the server', $collectionName)); $this->assertNull($foundCollection, sprintf('Collection %s exists', $collectionName));
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment