You are here

public function DynamicRouterTest::testMatchRequest in Zircon Profile 8

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

File

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

Class

DynamicRouterTest

Namespace

Symfony\Cmf\Component\Routing\Tests\Routing

Code

public function testMatchRequest() {
  $routeDefaults = array(
    'foo' => 'bar',
  );
  $matcher = $this
    ->buildMock('Symfony\\Component\\Routing\\Matcher\\RequestMatcherInterface', array(
    'matchRequest',
    'setContext',
    'getContext',
  ));
  $router = new DynamicRouter($this->context, $matcher, $this->generator);
  $matcher
    ->expects($this
    ->once())
    ->method('matchRequest')
    ->with($this->request)
    ->will($this
    ->returnValue($routeDefaults));
  $expected = array(
    'this' => 'that',
  );
  $this->enhancer
    ->expects($this
    ->once())
    ->method('enhance')
    ->with($this
    ->equalTo($routeDefaults), $this
    ->equalTo($this->request))
    ->will($this
    ->returnValue($expected));
  $router
    ->addRouteEnhancer($this->enhancer);
  $this
    ->assertEquals($expected, $router
    ->matchRequest($this->request));
}