public function testOptions() { $route =
new Route('/{foo}'
);
$route->
setOptions(['foo' => 'bar'
]);
$this->
assertEquals(array_merge([ 'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler',
],
['foo' => 'bar'
]),
$route->
getOptions(), '->setOptions() sets the options'
);
$this->
assertEquals($route,
$route->
setOptions([]), '->setOptions() implements a fluent interface'
);
$route->
setOptions(['foo' => 'foo'
]);
$route->
addOptions(['bar' => 'bar'
]);
$this->
assertEquals($route,
$route->
addOptions([]), '->addOptions() implements a fluent interface'
);
$this->
assertEquals(['foo' => 'foo', 'bar' => 'bar', 'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler'
],
$route->
getOptions(), '->addDefaults() keep previous defaults'
);
} public function testOption() { $route =
new Route('/{foo}'
);
$this->
assertFalse($route->
hasOption('foo'
), '->hasOption() return false if option is not set'
);
$this->
assertEquals($route,
$route->
setOption('foo', 'bar'
), '->setOption() implements a fluent interface'
);
$this->
assertEquals('bar',
$route->
getOption('foo'
), '->setOption() sets the option'
);
$this->
assertTrue($route->
hasOption('foo'
), '->hasOption() return true if option is set'
);
}