function ContainerAwareEventDispatcherTest::testGetListenerPriority
Same name in other branches
- 8.9.x core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php \Drupal\Tests\Component\EventDispatcher\ContainerAwareEventDispatcherTest::testGetListenerPriority()
- 10 core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php \Drupal\Tests\Component\EventDispatcher\ContainerAwareEventDispatcherTest::testGetListenerPriority()
- 11.x core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php \Drupal\Tests\Component\EventDispatcher\ContainerAwareEventDispatcherTest::testGetListenerPriority()
File
-
core/
tests/ Drupal/ Tests/ Component/ EventDispatcher/ ContainerAwareEventDispatcherTest.php, line 329
Class
- ContainerAwareEventDispatcherTest
- Unit tests for the ContainerAwareEventDispatcher.
Namespace
Drupal\Tests\Component\EventDispatcherCode
public function testGetListenerPriority() {
$listener1 = new TestEventListener();
$listener2 = new TestEventListener();
$this->dispatcher
->addListener('pre.foo', $listener1, -10);
$this->dispatcher
->addListener('pre.foo', $listener2);
$this->assertSame(-10, $this->dispatcher
->getListenerPriority('pre.foo', $listener1));
$this->assertSame(0, $this->dispatcher
->getListenerPriority('pre.foo', $listener2));
$this->assertNull($this->dispatcher
->getListenerPriority('pre.bar', $listener2));
$this->assertNull($this->dispatcher
->getListenerPriority('pre.foo', function () {
}));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.