function ContainerAwareEventDispatcherTest::testDispatchForClosure
File
-
core/
tests/ Drupal/ Tests/ Component/ EventDispatcher/ ContainerAwareEventDispatcherTest.php, line 324
Class
- ContainerAwareEventDispatcherTest
- Unit tests for the ContainerAwareEventDispatcher.
Namespace
Drupal\Tests\Component\EventDispatcherCode
public function testDispatchForClosure() : void {
$invoked = 0;
$listener = function () use (&$invoked) {
++$invoked;
};
$this->dispatcher
->addListener('pre.foo', $listener);
$this->dispatcher
->addListener('post.foo', $listener);
$this->dispatcher
->dispatch(new Event(), self::PRE_FOO);
$this->assertEquals(1, $invoked);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.