public function RegisterRoutersPassTest::testValidRouters in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony-cmf/routing/Tests/DependencyInjection/Compiler/RegisterRoutersPassTest.php \Symfony\Cmf\Routing\Tests\DependencyInjection\Compiler\RegisterRoutersPassTest::testValidRouters()
@dataProvider getValidRoutersData
File
- vendor/
symfony-cmf/ routing/ Tests/ DependencyInjection/ Compiler/ RegisterRoutersPassTest.php, line 23
Class
Namespace
Symfony\Cmf\Routing\Tests\DependencyInjection\CompilerCode
public function testValidRouters($name, $priority = null) {
if (!method_exists($this, 'callback')) {
$this
->markTestSkipped('PHPUnit version too old for this test');
}
$services = array();
$services[$name] = array(
0 => array(
'priority' => $priority,
),
);
$priority = $priority ?: 0;
$definition = $this
->getMock('Symfony\\Component\\DependencyInjection\\Definition');
$definition
->expects($this
->atLeastOnce())
->method('addMethodCall')
->with($this
->equalTo('add'), $this
->callback(function ($arg) use ($name, $priority) {
if (!$arg[0] instanceof Reference || $name !== $arg[0]
->__toString()) {
return false;
}
if ($priority !== $arg[1]) {
return false;
}
return true;
}));
$builder = $this
->getMock('Symfony\\Component\\DependencyInjection\\ContainerBuilder', array(
'hasDefinition',
'findTaggedServiceIds',
'getDefinition',
));
$builder
->expects($this
->any())
->method('hasDefinition')
->with('cmf_routing.router')
->will($this
->returnValue(true));
$builder
->expects($this
->atLeastOnce())
->method('findTaggedServiceIds')
->will($this
->returnValue($services));
$builder
->expects($this
->atLeastOnce())
->method('getDefinition')
->will($this
->returnValue($definition));
$registerRoutersPass = new RegisterRoutersPass();
$registerRoutersPass
->process($builder);
}