You are here

public function RegisterRouteEnhancersPassTest::testRouteEnhancerPass in Zircon Profile 8

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

File

vendor/symfony-cmf/routing/Tests/DependencyInjection/Compiler/RegisterRouteEnhancersPassTest.php, line 20

Class

RegisterRouteEnhancersPassTest

Namespace

Symfony\Cmf\Component\Routing\Tests\DependencyInjection\Compiler

Code

public function testRouteEnhancerPass() {
  $serviceIds = array(
    'test_enhancer' => array(
      0 => array(
        'id' => 'foo_enhancer',
      ),
    ),
  );
  $definition = new Definition('router');
  $builder = $this
    ->getMock('Symfony\\Component\\DependencyInjection\\ContainerBuilder');
  $builder
    ->expects($this
    ->at(0))
    ->method('hasDefinition')
    ->with('cmf_routing.dynamic_router')
    ->will($this
    ->returnValue(true));
  $builder
    ->expects($this
    ->once())
    ->method('findTaggedServiceIds')
    ->will($this
    ->returnValue($serviceIds));
  $builder
    ->expects($this
    ->once())
    ->method('getDefinition')
    ->with('cmf_routing.dynamic_router')
    ->will($this
    ->returnValue($definition));
  $pass = new RegisterRouteEnhancersPass();
  $pass
    ->process($builder);
  $calls = $definition
    ->getMethodCalls();
  $this
    ->assertEquals(1, count($calls));
  $this
    ->assertEquals('addRouteEnhancer', $calls[0][0]);
}