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

Simplify arguments for assertCollectionDoesNotExist()

parent a2715b13
......@@ -2,7 +2,6 @@
namespace MongoDB\Tests\Operation;
use MongoDB\Driver\Server;
use MongoDB\Operation\DropCollection;
use MongoDB\Operation\InsertOne;
use MongoDB\Operation\ListCollections;
......@@ -20,7 +19,7 @@ class DropCollectionFunctionalTest extends FunctionalTestCase
$operation = new DropCollection($this->getDatabaseName(), $this->getCollectionName());
$operation->execute($server);
$this->assertCollectionDoesNotExist($server, $this->getDatabaseName(), $this->getCollectionName());
$this->assertCollectionDoesNotExist($this->getCollectionName());
}
/**
......@@ -28,26 +27,22 @@ class DropCollectionFunctionalTest extends FunctionalTestCase
*/
public function testDropNonexistentCollection()
{
$server = $this->getPrimaryServer();
$this->assertCollectionDoesNotExist($server, $this->getDatabaseName(), $this->getCollectionName());
$this->assertCollectionDoesNotExist($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
* server.
*
* @param Server $server
* @param string $databaseName
* @param string $collectionName
*/
private function assertCollectionDoesNotExist(Server $server, $databaseName, $collectionName)
private function assertCollectionDoesNotExist($collectionName)
{
$operation = new ListCollections($databaseName);
$collections = $operation->execute($server);
$operation = new ListCollections($this->getDatabaseName());
$collections = $operation->execute($this->getPrimaryServer());
$foundCollection = null;
......@@ -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