public function testDistinct() { $collectionName = 'myCollectionName'; $field = 'fieldName'; $query = array(); $result = array(new \DateTime()); $mongoDB = $this->getMockBuilder('MongoDB')->disableOriginalConstructor()->getMock(); $mongoDB->expects($this->once())->method('command')->with(array('distinct' => $collectionName, 'key' => $field, 'query' => $query))->will($this->returnValue($result)); $connection = $this->getMock('Mandango\\ConnectionInterface'); $connection->expects($this->any())->method('getMongoDB')->will($this->returnValue($mongoDB)); $repository = new RepositoryMock($this->mandango); $repository->setCollectionName($collectionName); $repository->setConnection($connection); $this->assertSame($result, $repository->distinct($field, $query)); }