You are here

public function TraceableEventDispatcherTest::testLoggerWithStoppedEvent in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php \Symfony\Component\EventDispatcher\Tests\Debug\TraceableEventDispatcherTest::testLoggerWithStoppedEvent()

File

vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php, line 119

Class

TraceableEventDispatcherTest

Namespace

Symfony\Component\EventDispatcher\Tests\Debug

Code

public function testLoggerWithStoppedEvent() {
  $logger = $this
    ->getMock('Psr\\Log\\LoggerInterface');
  $dispatcher = new EventDispatcher();
  $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch(), $logger);
  $tdispatcher
    ->addListener('foo', $listener1 = function (Event $event) {
    $event
      ->stopPropagation();
  });
  $tdispatcher
    ->addListener('foo', $listener2 = function () {
  });
  $logger
    ->expects($this
    ->at(0))
    ->method('debug')
    ->with('Notified event "foo" to listener "closure".');
  $logger
    ->expects($this
    ->at(1))
    ->method('debug')
    ->with('Listener "closure" stopped propagation of the event "foo".');
  $logger
    ->expects($this
    ->at(2))
    ->method('debug')
    ->with('Listener "closure" was not called for event "foo".');
  $tdispatcher
    ->dispatch('foo');
}