From 58e6ca62420a1dbbe844be083d0da6319d4a4c64 Mon Sep 17 00:00:00 2001 From: William DURAND Date: Mon, 25 Jun 2012 15:49:28 +0200 Subject: [PATCH] Fixed tests for 5.3 --- tests/EventDispatcherBehaviorTest.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/EventDispatcherBehaviorTest.php b/tests/EventDispatcherBehaviorTest.php index da4f386..56d20e4 100644 --- a/tests/EventDispatcherBehaviorTest.php +++ b/tests/EventDispatcherBehaviorTest.php @@ -58,18 +58,19 @@ public function testFireEvent() $preSaveFired = false; $postSaveFired = false; - Post::getEventDispatcher()->addListener(Post::EVENT_PRE_SAVE, function (Event $event) use (& $preSaveFired) { + $that = $this; + Post::getEventDispatcher()->addListener(Post::EVENT_PRE_SAVE, function (Event $event) use (& $preSaveFired, $that) { $preSaveFired = true; - $this->assertInstanceOf('Symfony\Component\EventDispatcher\GenericEvent', $event); - $this->assertInstanceOf('Post', $event->getSubject()); + $that->assertInstanceOf('Symfony\Component\EventDispatcher\GenericEvent', $event); + $that->assertInstanceOf('Post', $event->getSubject()); }); - Post::getEventDispatcher()->addListener(Post::EVENT_POST_SAVE, function (Event $event) use (& $postSaveFired) { + Post::getEventDispatcher()->addListener(Post::EVENT_POST_SAVE, function (Event $event) use (& $postSaveFired, $that) { $postSaveFired = true; - $this->assertInstanceOf('Symfony\Component\EventDispatcher\GenericEvent', $event); - $this->assertInstanceOf('Post', $event->getSubject()); + $that->assertInstanceOf('Symfony\Component\EventDispatcher\GenericEvent', $event); + $that->assertInstanceOf('Post', $event->getSubject()); }); $post = new Post();