public function testGetEntityIds() { $entityClass = 'stdClass'; $fooEntity = new \stdClass(); $fooEntity->id = 1; $barEntity = new \stdClass(); $barEntity->id = 2; $entities = array($fooEntity, $barEntity); $expectedIdentifiers = array($fooEntity->id, $barEntity->id); $this->entityManager->expects($this->exactly(2))->method('getMetadataFactory')->will($this->returnValue($this->metadataFactory)); $this->metadataFactory->expects($this->exactly(2))->method('getMetadataFor')->with($entityClass)->will($this->returnValue($this->metadata)); $this->metadata->expects($this->at(0))->method('getIdentifierValues')->with($fooEntity)->will($this->returnValue(array('id' => $fooEntity->id))); $this->metadata->expects($this->at(1))->method('getIdentifierValues')->with($barEntity)->will($this->returnValue(array('id' => $barEntity->id))); $this->assertEquals($expectedIdentifiers, $this->doctrineHelper->getEntityIds($entities)); }