public function EventDispatcherTest::testAddSubscriberWithPriorities

File

drupal/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php, line 183

Class

EventDispatcherTest

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]);
}