You are here

public function AbstractEventDispatcherTest::testAddListener in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php \Symfony\Component\EventDispatcher\Tests\AbstractEventDispatcherTest::testAddListener()

File

vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php, line 54

Class

AbstractEventDispatcherTest

Namespace

Symfony\Component\EventDispatcher\Tests

Code

public function testAddListener() {
  $this->dispatcher
    ->addListener('pre.foo', array(
    $this->listener,
    'preFoo',
  ));
  $this->dispatcher
    ->addListener('post.foo', array(
    $this->listener,
    'postFoo',
  ));
  $this
    ->assertTrue($this->dispatcher
    ->hasListeners(self::preFoo));
  $this
    ->assertTrue($this->dispatcher
    ->hasListeners(self::postFoo));
  $this
    ->assertCount(1, $this->dispatcher
    ->getListeners(self::preFoo));
  $this
    ->assertCount(1, $this->dispatcher
    ->getListeners(self::postFoo));
  $this
    ->assertCount(2, $this->dispatcher
    ->getListeners());
}