Last active
December 14, 2015 02:19
-
-
Save zluiten/5013064 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function configureObjectManagerForOneToManyEntity() | |
{ | |
//snip | |
$this->hydratorByValue = $this->getMock( | |
'DoctrineModule\Stdlib\Hydrator\DoctrineObject', | |
null, | |
array($this->objectManager, 'DoctrineModuleTest\Stdlib\Hydrator\Asset\OneToManyEntity', true) | |
); | |
//snip | |
} | |
public function testHydrateValueIsCalledWhenHydratingCollectionValuedAssociationByValue() | |
{ | |
$toMany1 = new Asset\SimpleEntity(); | |
$toMany1->setId(2); | |
$toMany1->setField('foo', false); | |
$toMany2 = new Asset\SimpleEntity(); | |
$toMany2->setId(3); | |
$toMany2->setField('bar', false); | |
$entity = new Asset\OneToManyEntity(); | |
$this->configureObjectManagerForOneToManyEntity(); | |
$entity->addEntities(new ArrayCollection(array($toMany1))); | |
$data = array('entities' => array($toMany2)); | |
$this->hydratorByValue->expects($this->once()) | |
->method('hydrate'); | |
$entity = $this->hydratorByValue->hydrate($data, $entity); | |
} | |
?> | |
PHPUnit 3.7.10 by Sebastian Bergmann. | |
Configuration read from /home/zluiten/dev/DoctrineModule/tests/phpunit.xml | |
...................................F. | |
Time: 0 seconds, Memory: 4.25Mb | |
There was 1 failure: | |
1) DoctrineModuleTest\Stdlib\Hydrator\DoctrineObjectTest::testHydrateValueIsCalledWhenHydratingCollectionValuedAssociationByValue | |
Expectation failed for method name is equal to <string:hydrate> when invoked 1 time(s). | |
Method was expected to be called 1 times, actually called 0 times. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment