Skip to content

Commit

Permalink
Fixed tests for 5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
willdurand committed Jun 25, 2012
1 parent 59f4887 commit 58e6ca6
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/EventDispatcherBehaviorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 58e6ca6

Please sign in to comment.