You are here

public function AbstractEventDispatcherTest::testAddSubscriberWithPriorities in Zircon Profile 8.0

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

File

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

Class

AbstractEventDispatcherTest

Namespace

Symfony\Component\EventDispatcher\Tests

Code

public function testAddSubscriberWithPriorities() {
  $eventSubscriber = new TestEventSubscriber();
  $this->dispatcher
    ->addSubscriber($eventSubscriber);
  $eventSubscriber = new TestEventSubscriberWithPriorities();
  $this->dispatcher
    ->addSubscriber($eventSubscriber);
  $listeners = $this->dispatcher
    ->getListeners('pre.foo');
  $this
    ->assertTrue($this->dispatcher
    ->hasListeners(self::preFoo));
  $this
    ->assertCount(2, $listeners);
  $this
    ->assertInstanceOf('Symfony\\Component\\EventDispatcher\\Tests\\TestEventSubscriberWithPriorities', $listeners[0][0]);
}