Commit e574c2df authored by Jeremy Mikola's avatar Jeremy Mikola

PHPLIB-45: Test listCollections with filter option

parent ccf1eba5
......@@ -71,8 +71,8 @@ class DatabaseFunctionalTest extends FunctionalTestCase
public function testListCollections()
{
$writeResult = $this->manager->executeInsert($this->getNamespace(), array('x' => 1));
$this->assertEquals(1, $writeResult->getInsertedCount());
$commandResult = $this->database->createCollection($this->getCollectionName());
$this->assertCommandSucceeded($commandResult);
$collections = $this->database->listCollections();
$this->assertInstanceOf('MongoDB\Model\CollectionInfoIterator', $collections);
......@@ -82,6 +82,24 @@ class DatabaseFunctionalTest extends FunctionalTestCase
}
}
public function testListCollectionsWithFilter()
{
$commandResult = $this->database->createCollection($this->getCollectionName());
$this->assertCommandSucceeded($commandResult);
$collectionName = $this->getCollectionName();
$options = array('filter' => array('name' => $collectionName));
$collections = $this->database->listCollections($options);
$this->assertInstanceOf('MongoDB\Model\CollectionInfoIterator', $collections);
$this->assertCount(1, $collections);
foreach ($collections as $collection) {
$this->assertInstanceOf('MongoDB\Model\CollectionInfo', $collection);
$this->assertEquals($collectionName, $collection->getName());
}
}
/**
* Asserts that a collection with the given name exists in the database.
*
......
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