public function TraceableEventDispatcherTest::testAddListenerNested in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/http-kernel/Tests/Debug/TraceableEventDispatcherTest.php \Symfony\Component\HttpKernel\Tests\Debug\TraceableEventDispatcherTest::testAddListenerNested()
File
- vendor/
symfony/ http-kernel/ Tests/ Debug/ TraceableEventDispatcherTest.php, line 78
Class
Namespace
Symfony\Component\HttpKernel\Tests\DebugCode
public function testAddListenerNested() {
$called1 = false;
$called2 = false;
$dispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
$dispatcher
->addListener('my-event', function () use ($dispatcher, &$called1, &$called2) {
$called1 = true;
$dispatcher
->addListener('my-event', function () use (&$called2) {
$called2 = true;
});
});
$dispatcher
->dispatch('my-event');
$this
->assertTrue($called1);
$this
->assertFalse($called2);
$dispatcher
->dispatch('my-event');
$this
->assertTrue($called2);
}