Skip to content

Commit

Permalink
[EventDispatcher] fixed deprecation notices in the EventDispatcher Co…
Browse files Browse the repository at this point in the history
…mponent
  • Loading branch information
fabpot committed Jan 8, 2015
1 parent f812eb8 commit b81b65b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion GenericEvent.php
Expand Up @@ -71,7 +71,7 @@ public function getArgument($key)
return $this->arguments[$key];
}

throw new \InvalidArgumentException(sprintf('%s not found in %s', $key, $this->getName()));
throw new \InvalidArgumentException(sprintf('Argument "%s" not found.', $key));
}

/**
Expand Down
14 changes: 12 additions & 2 deletions Tests/AbstractEventDispatcherTest.php
Expand Up @@ -118,10 +118,18 @@ public function testDispatch()
$this->assertInstanceOf('Symfony\Component\EventDispatcher\Event', $this->dispatcher->dispatch(self::preFoo));
$event = new Event();
$return = $this->dispatcher->dispatch(self::preFoo, $event);
$this->assertEquals('pre.foo', $event->getName());
$this->assertSame($event, $return);
}

public function testLegacyDispatch()
{
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);

$event = new Event();
$return = $this->dispatcher->dispatch(self::preFoo, $event);
$this->assertEquals('pre.foo', $event->getName());
}

public function testDispatchForClosure()
{
$invoked = 0;
Expand Down Expand Up @@ -239,8 +247,10 @@ public function testRemoveSubscriberWithMultipleListeners()
$this->assertFalse($this->dispatcher->hasListeners(self::preFoo));
}

public function testEventReceivesTheDispatcherInstance()
public function testLegacyEventReceivesTheDispatcherInstance()
{
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);

$dispatcher = null;
$this->dispatcher->addListener('test', function ($event) use (&$dispatcher) {
$dispatcher = $event->getDispatcher();
Expand Down

0 comments on commit b81b65b

Please sign in to comment.