#1001 DDC-3005 - Verifying HydrationCompleteHandler
skips over registered deferred loads that were already handled by hydrationComplete
This commit is contained in:
parent
29d4d342bd
commit
8c54a65aa5
1 changed files with 29 additions and 2 deletions
|
@ -95,6 +95,33 @@ class HydrationCompleteHandlerTest extends PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
$this->handler->hydrationComplete();
|
$this->handler->hydrationComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider testGetValidListenerInvocationFlags
|
||||||
|
*
|
||||||
|
* @param int $listenersFlag
|
||||||
|
*/
|
||||||
|
public function testDefersPostLoadOfEntityOnlyOnce($listenersFlag)
|
||||||
|
{
|
||||||
|
/* @var $metadata \Doctrine\ORM\Mapping\ClassMetadata */
|
||||||
|
$metadata = $this->getMock('Doctrine\ORM\Mapping\ClassMetadata', array(), array(), '', false);
|
||||||
|
$entity = new stdClass();
|
||||||
|
|
||||||
|
$this
|
||||||
|
->listenersInvoker
|
||||||
|
->expects($this->any())
|
||||||
|
->method('getSubscribedSystems')
|
||||||
|
->with($metadata)
|
||||||
|
->will($this->returnValue($listenersFlag));
|
||||||
|
|
||||||
|
$this->handler->deferPostLoadInvoking($metadata, $entity);
|
||||||
|
|
||||||
|
$this->listenersInvoker->expects($this->once())->method('invoke');
|
||||||
|
|
||||||
|
$this->handler->hydrationComplete();
|
||||||
|
$this->handler->hydrationComplete();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider testGetValidListenerInvocationFlags
|
* @dataProvider testGetValidListenerInvocationFlags
|
||||||
*
|
*
|
||||||
|
@ -141,8 +168,8 @@ class HydrationCompleteHandlerTest extends PHPUnit_Framework_TestCase
|
||||||
public function testSkipsDeferredPostLoadOfMetadataWithNoInvokedListeners()
|
public function testSkipsDeferredPostLoadOfMetadataWithNoInvokedListeners()
|
||||||
{
|
{
|
||||||
/* @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);
|
||||||
$entity = new stdClass();
|
$entity = new stdClass();
|
||||||
|
|
||||||
$this
|
$this
|
||||||
->listenersInvoker
|
->listenersInvoker
|
||||||
|
|
Loading…
Add table
Reference in a new issue