From 7b0f59ed7c2a787193bd509808f36e3f2311143f Mon Sep 17 00:00:00 2001 From: "Fabio B. Silva" Date: Fri, 9 Nov 2012 15:47:57 -0200 Subject: [PATCH] split override test --- lib/Doctrine/ORM/Event/ListenersInvoker.php | 2 +- .../Tests/ORM/Functional/EntityListenersTest.php | 2 -- .../Tests/ORM/Mapping/AbstractMappingDriverTest.php | 12 +++++++++++- .../Tests/ORM/Mapping/EntityListenerResolverTest.php | 2 -- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/Doctrine/ORM/Event/ListenersInvoker.php b/lib/Doctrine/ORM/Event/ListenersInvoker.php index 7ef6bb51d..ae16856cb 100644 --- a/lib/Doctrine/ORM/Event/ListenersInvoker.php +++ b/lib/Doctrine/ORM/Event/ListenersInvoker.php @@ -72,7 +72,7 @@ class ListenersInvoker $method = $listener['method']; $instance = $this->resolver->resolve($class); - $instance->{$method}($entity, $event); + $instance->$method($entity, $event); } } } \ No newline at end of file diff --git a/tests/Doctrine/Tests/ORM/Functional/EntityListenersTest.php b/tests/Doctrine/Tests/ORM/Functional/EntityListenersTest.php index fc6048e60..584795263 100644 --- a/tests/Doctrine/Tests/ORM/Functional/EntityListenersTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/EntityListenersTest.php @@ -4,8 +4,6 @@ namespace Doctrine\Tests\ORM\Functional; use Doctrine\Tests\Models\Company\CompanyFixContract; -require_once __DIR__ . '/../../TestInit.php'; - /** * @group DDC-1955 */ diff --git a/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php b/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php index 7be69c1f0..bfbab9e32 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/AbstractMappingDriverTest.php @@ -780,6 +780,16 @@ abstract class AbstractMappingDriverTest extends \Doctrine\Tests\OrmTestCase //Inherited listeners $this->assertEquals($fixClass->entityListeners, $superClass->entityListeners); $this->assertEquals($flexClass->entityListeners, $superClass->entityListeners); + } + + /** + * @group DDC-1955 + */ + public function testEntityListenersOverride() + { + $em = $this->_getTestEntityManager(); + $factory = $this->createClassMetadataFactory($em); + $ultraClass = $factory->getMetadataFor('Doctrine\Tests\Models\Company\CompanyFlexUltraContract'); //overrited listeners $this->assertArrayHasKey(Events::postPersist, $ultraClass->entityListeners); @@ -799,7 +809,7 @@ abstract class AbstractMappingDriverTest extends \Doctrine\Tests\OrmTestCase $prePersist = $ultraClass->entityListeners[Events::prePersist][1]; $this->assertEquals('Doctrine\Tests\Models\Company\CompanyFlexUltraContractListener', $prePersist['class']); $this->assertEquals('prePersistHandler1', $prePersist['method']); - + $prePersist = $ultraClass->entityListeners[Events::prePersist][2]; $this->assertEquals('Doctrine\Tests\Models\Company\CompanyFlexUltraContractListener', $prePersist['class']); $this->assertEquals('prePersistHandler2', $prePersist['method']); diff --git a/tests/Doctrine/Tests/ORM/Mapping/EntityListenerResolverTest.php b/tests/Doctrine/Tests/ORM/Mapping/EntityListenerResolverTest.php index a17103391..64007b031 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/EntityListenerResolverTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/EntityListenerResolverTest.php @@ -4,8 +4,6 @@ namespace Doctrine\Tests\ORM\Mapping; use Doctrine\ORM\Mapping\DefaultEntityListenerResolver; -require_once __DIR__ . '/../../TestInit.php'; - /** * @group DDC-1955 */