$collection1->
add('bar',
new Route('/{placeholder}',
['_controller' => 'fixed', 'placeholder' => 'default'
],
['placeholder' => '.+'
],
['option' => 'value'
]) );
$collection->
addCollection($collection1);
$collection->
addDefaults(['placeholder' => 'new-default'
]);
$this->
assertEquals(['placeholder' => 'new-default'
],
$collection->
get('foo'
)->
getDefaults(), '->addDefaults() adds defaults to all routes'
);
$this->
assertEquals(['_controller' => 'fixed', 'placeholder' => 'new-default'
],
$collection->
get('bar'
)->
getDefaults(),
'->addDefaults() adds defaults to all routes and overwrites existing ones'
);
$collection->
addRequirements(['placeholder' => '\d+'
]);
$this->
assertEquals(['placeholder' => '\d+'
],
$collection->
get('foo'
)->
getRequirements(), '->addRequirements() adds requirements to all routes'
);
$this->
assertEquals(['placeholder' => '\d+'
],
$collection->
get('bar'
)->
getRequirements(),
'->addRequirements() adds requirements to all routes and overwrites existing ones'
);
$collection->
addOptions(['option' => 'new-value'
]);
$this->
assertEquals( ['option' => 'new-value', 'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler'
],
$collection->
get('bar'
)->
getOptions(), '->addOptions() adds options to all routes and overwrites existing ones'
);
} public function testAddPrefix() {