public function testAddRouterWithDefaultRouter($declaredPriority, $expectedPriority)
{
$defaultRouter = new Definition();
$this->setDefinition('router.default', $defaultRouter);
$resolverDef = new Definition();
$serviceId = 'some_service_id';
if ($declaredPriority !== null) {
$resolverDef->addTag('router', array('priority' => $declaredPriority));
} else {
$resolverDef->addTag('router');
}
$this->setDefinition($serviceId, $resolverDef);
$this->compile();
// Assertion for default router
$this->assertContainerBuilderHasServiceDefinitionWithMethodCall('router.default', 'setSiteAccess', array(new Reference('ezpublish.siteaccess')));
$this->assertContainerBuilderHasServiceDefinitionWithMethodCall('router.default', 'setConfigResolver', array(new Reference('ezpublish.config.resolver')));
$this->assertContainerBuilderHasServiceDefinitionWithMethodCall('router.default', 'setNonSiteAccessAwareRoutes', array('%ezpublish.default_router.non_siteaccess_aware_routes%'));
$this->assertContainerBuilderHasServiceDefinitionWithMethodCall('router.default', 'setSiteAccessRouter', array(new Reference('ezpublish.siteaccess_router')));
$this->assertContainerBuilderHasServiceDefinitionWithMethodCall('ezpublish.chain_router', 'add', array(new Reference('router.default'), 255));
// Assertion for all routers
$this->assertContainerBuilderHasServiceDefinitionWithMethodCall('ezpublish.chain_router', 'add', array(new Reference($serviceId), $expectedPriority));
}