You are here

class RegisterRouteEnhancersPassTest 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

Hierarchy

  • class \Symfony\Cmf\Component\Routing\Tests\DependencyInjection\Compiler\RegisterRouteEnhancersPassTest extends \Symfony\Cmf\Component\Routing\Tests\DependencyInjection\Compiler\PHPUnit_Framework_TestCase

Expanded class hierarchy of RegisterRouteEnhancersPassTest

File

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

Namespace

Symfony\Cmf\Component\Routing\Tests\DependencyInjection\Compiler
View source
class RegisterRouteEnhancersPassTest extends \PHPUnit_Framework_TestCase {
  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]);
  }

  /**
   * If there is no dynamic router defined in the container builder, nothing
   * should be processed.
   */
  public function testNoDynamicRouter() {
    $builder = $this
      ->getMock('Symfony\\Component\\DependencyInjection\\ContainerBuilder');
    $builder
      ->expects($this
      ->once())
      ->method('hasDefinition')
      ->with('cmf_routing.dynamic_router')
      ->will($this
      ->returnValue(false));
    $pass = new RegisterRouteEnhancersPass();
    $pass
      ->process($builder);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RegisterRouteEnhancersPassTest::testNoDynamicRouter public function If there is no dynamic router defined in the container builder, nothing should be processed.
RegisterRouteEnhancersPassTest::testRouteEnhancerPass public function