You are here

public function DynamicRouterTest::testEventHandler in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony-cmf/routing/Tests/Routing/DynamicRouterTest.php \Symfony\Cmf\Component\Routing\Tests\Routing\DynamicRouterTest::testEventHandler()

File

vendor/symfony-cmf/routing/Tests/Routing/DynamicRouterTest.php, line 285

Class

DynamicRouterTest

Namespace

Symfony\Cmf\Component\Routing\Tests\Routing

Code

public function testEventHandler() {
  $eventDispatcher = $this
    ->buildMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface');
  $router = new DynamicRouter($this->context, $this->matcher, $this->generator, '', $eventDispatcher);
  $eventDispatcher
    ->expects($this
    ->once())
    ->method('dispatch')
    ->with(Events::PRE_DYNAMIC_MATCH, $this
    ->equalTo(new RouterMatchEvent()));
  $routeDefaults = array(
    'foo' => 'bar',
  );
  $this->matcher
    ->expects($this
    ->once())
    ->method('match')
    ->with($this->url)
    ->will($this
    ->returnValue($routeDefaults));
  $this
    ->assertEquals($routeDefaults, $router
    ->match($this->url));
}