From 833058fd2e48bc78ec87fdbc0e8da1c61a8bb1f1 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Tue, 13 Jan 2015 00:36:17 +0100 Subject: [PATCH] #1001 DDC-3005 - Testing `HydrationCompleteHandler` when no events should be triggered --- .../Internal/HydrationCompleteHandlerTest.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/Doctrine/Tests/ORM/Internal/HydrationCompleteHandlerTest.php b/tests/Doctrine/Tests/ORM/Internal/HydrationCompleteHandlerTest.php index 14b930db2..10c2fdf76 100644 --- a/tests/Doctrine/Tests/ORM/Internal/HydrationCompleteHandlerTest.php +++ b/tests/Doctrine/Tests/ORM/Internal/HydrationCompleteHandlerTest.php @@ -90,4 +90,24 @@ class HydrationCompleteHandlerTest extends PHPUnit_Framework_TestCase $this->handler->hydrationComplete(); } + + public function testSkipsDeferredPostLoadOfMetadataWithNoInvokedListeners() + { + /* @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(ListenersInvoker::INVOKE_NONE)); + + $this->handler->deferPostLoadInvoking($metadata, $entity); + + $this->listenersInvoker->expects($this->never())->method('invoke'); + + $this->handler->hydrationComplete(); + } }