public function DynamicRouterTest::testMatchRequest

File

drupal/core/vendor/symfony-cmf/routing/Symfony/Cmf/Component/Routing/Tests/Routing/DynamicRouterTest.php, line 164

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));
}