#1001 DDC-3005 - Testing HydrationCompleteHandler
against all possible ListenersInvoker
flags
This commit is contained in:
parent
833058fd2e
commit
948d6c2b9f
1 changed files with 18 additions and 3 deletions
|
@ -58,7 +58,10 @@ class HydrationCompleteHandlerTest extends PHPUnit_Framework_TestCase
|
||||||
$this->handler = new HydrationCompleteHandler($this->listenersInvoker, $this->entityManager);
|
$this->handler = new HydrationCompleteHandler($this->listenersInvoker, $this->entityManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDefersPostLoadOfEntity()
|
/**
|
||||||
|
* @dataProvider testGetValidListenerInvocationFlags
|
||||||
|
*/
|
||||||
|
public function testDefersPostLoadOfEntity($listenersFlag)
|
||||||
{
|
{
|
||||||
/* @var $metadata \Doctrine\ORM\Mapping\ClassMetadata */
|
/* @var $metadata \Doctrine\ORM\Mapping\ClassMetadata */
|
||||||
$metadata = $this->getMock('Doctrine\ORM\Mapping\ClassMetadata', array(), array(), '', false);
|
$metadata = $this->getMock('Doctrine\ORM\Mapping\ClassMetadata', array(), array(), '', false);
|
||||||
|
@ -70,7 +73,7 @@ class HydrationCompleteHandlerTest extends PHPUnit_Framework_TestCase
|
||||||
->expects($this->any())
|
->expects($this->any())
|
||||||
->method('getSubscribedSystems')
|
->method('getSubscribedSystems')
|
||||||
->with($metadata)
|
->with($metadata)
|
||||||
->will($this->returnValue(ListenersInvoker::INVOKE_LISTENERS));
|
->will($this->returnValue($listenersFlag));
|
||||||
|
|
||||||
$this->handler->deferPostLoadInvoking($metadata, $entity);
|
$this->handler->deferPostLoadInvoking($metadata, $entity);
|
||||||
|
|
||||||
|
@ -85,7 +88,7 @@ class HydrationCompleteHandlerTest extends PHPUnit_Framework_TestCase
|
||||||
$this->callback(function (LifecycleEventArgs $args) use ($entityManager, $entity) {
|
$this->callback(function (LifecycleEventArgs $args) use ($entityManager, $entity) {
|
||||||
return $entity === $args->getEntity() && $entityManager === $args->getObjectManager();
|
return $entity === $args->getEntity() && $entityManager === $args->getObjectManager();
|
||||||
}),
|
}),
|
||||||
ListenersInvoker::INVOKE_LISTENERS
|
$listenersFlag
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->handler->hydrationComplete();
|
$this->handler->hydrationComplete();
|
||||||
|
@ -110,4 +113,16 @@ class HydrationCompleteHandlerTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
$this->handler->hydrationComplete();
|
$this->handler->hydrationComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testGetValidListenerInvocationFlags()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array(ListenersInvoker::INVOKE_LISTENERS),
|
||||||
|
array(ListenersInvoker::INVOKE_CALLBACKS),
|
||||||
|
array(ListenersInvoker::INVOKE_MANAGER),
|
||||||
|
array(ListenersInvoker::INVOKE_LISTENERS | ListenersInvoker::INVOKE_CALLBACKS),
|
||||||
|
array(ListenersInvoker::INVOKE_LISTENERS | ListenersInvoker::INVOKE_MANAGER),
|
||||||
|
array(ListenersInvoker::INVOKE_LISTENERS | ListenersInvoker::INVOKE_CALLBACKS | ListenersInvoker::INVOKE_MANAGER),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue