public function ContainerAwareEventDispatcherTest::testEventReceivesTheDispatcherInstanceAsArgument in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php \Drupal\Tests\Component\EventDispatcher\ContainerAwareEventDispatcherTest::testEventReceivesTheDispatcherInstanceAsArgument()
- 10 core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php \Drupal\Tests\Component\EventDispatcher\ContainerAwareEventDispatcherTest::testEventReceivesTheDispatcherInstanceAsArgument()
File
- core/
tests/ Drupal/ Tests/ Component/ EventDispatcher/ ContainerAwareEventDispatcherTest.php, line 407
Class
- ContainerAwareEventDispatcherTest
- Unit tests for the ContainerAwareEventDispatcher.
Namespace
Drupal\Tests\Component\EventDispatcherCode
public function testEventReceivesTheDispatcherInstanceAsArgument() {
$listener = new TestWithDispatcher();
$this->dispatcher
->addListener('test', [
$listener,
'foo',
]);
$this
->assertNull($listener->name);
$this
->assertNull($listener->dispatcher);
$this->dispatcher
->dispatch('test');
$this
->assertEquals('test', $listener->name);
$this
->assertSame($this->dispatcher, $listener->dispatcher);
}