public function ContainerAwareEventDispatcherTest::testAddSubscriberWithPriorities in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php \Drupal\Tests\Component\EventDispatcher\ContainerAwareEventDispatcherTest::testAddSubscriberWithPriorities()
- 10 core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php \Drupal\Tests\Component\EventDispatcher\ContainerAwareEventDispatcherTest::testAddSubscriberWithPriorities()
File
- core/
tests/ Drupal/ Tests/ Component/ EventDispatcher/ ContainerAwareEventDispatcherTest.php, line 357
Class
- ContainerAwareEventDispatcherTest
- Unit tests for the ContainerAwareEventDispatcher.
Namespace
Drupal\Tests\Component\EventDispatcherCode
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(TestEventSubscriberWithPriorities::class, $listeners[0][0]);
}