You are here

public function AbstractEventDispatcherTest::testDispatchForClosure in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php \Symfony\Component\EventDispatcher\Tests\AbstractEventDispatcherTest::testDispatchForClosure()

File

vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php, line 135

Class

AbstractEventDispatcherTest

Namespace

Symfony\Component\EventDispatcher\Tests

Code

public function testDispatchForClosure() {
  $invoked = 0;
  $listener = function () use (&$invoked) {
    ++$invoked;
  };
  $this->dispatcher
    ->addListener('pre.foo', $listener);
  $this->dispatcher
    ->addListener('post.foo', $listener);
  $this->dispatcher
    ->dispatch(self::preFoo);
  $this
    ->assertEquals(1, $invoked);
}