public function RouteCompilerTest::provideCompileData in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/routing/Tests/RouteCompilerTest.php \Symfony\Component\Routing\Tests\RouteCompilerTest::provideCompileData()
File
- vendor/
symfony/ routing/ Tests/ RouteCompilerTest.php, line 33
Class
Namespace
Symfony\Component\Routing\TestsCode
public function provideCompileData() {
return array(
array(
'Static route',
array(
'/foo',
),
'/foo',
'#^/foo$#s',
array(),
array(
array(
'text',
'/foo',
),
),
),
array(
'Route with a variable',
array(
'/foo/{bar}',
),
'/foo',
'#^/foo/(?P<bar>[^/]++)$#s',
array(
'bar',
),
array(
array(
'variable',
'/',
'[^/]++',
'bar',
),
array(
'text',
'/foo',
),
),
),
array(
'Route with a variable that has a default value',
array(
'/foo/{bar}',
array(
'bar' => 'bar',
),
),
'/foo',
'#^/foo(?:/(?P<bar>[^/]++))?$#s',
array(
'bar',
),
array(
array(
'variable',
'/',
'[^/]++',
'bar',
),
array(
'text',
'/foo',
),
),
),
array(
'Route with several variables',
array(
'/foo/{bar}/{foobar}',
),
'/foo',
'#^/foo/(?P<bar>[^/]++)/(?P<foobar>[^/]++)$#s',
array(
'bar',
'foobar',
),
array(
array(
'variable',
'/',
'[^/]++',
'foobar',
),
array(
'variable',
'/',
'[^/]++',
'bar',
),
array(
'text',
'/foo',
),
),
),
array(
'Route with several variables that have default values',
array(
'/foo/{bar}/{foobar}',
array(
'bar' => 'bar',
'foobar' => '',
),
),
'/foo',
'#^/foo(?:/(?P<bar>[^/]++)(?:/(?P<foobar>[^/]++))?)?$#s',
array(
'bar',
'foobar',
),
array(
array(
'variable',
'/',
'[^/]++',
'foobar',
),
array(
'variable',
'/',
'[^/]++',
'bar',
),
array(
'text',
'/foo',
),
),
),
array(
'Route with several variables but some of them have no default values',
array(
'/foo/{bar}/{foobar}',
array(
'bar' => 'bar',
),
),
'/foo',
'#^/foo/(?P<bar>[^/]++)/(?P<foobar>[^/]++)$#s',
array(
'bar',
'foobar',
),
array(
array(
'variable',
'/',
'[^/]++',
'foobar',
),
array(
'variable',
'/',
'[^/]++',
'bar',
),
array(
'text',
'/foo',
),
),
),
array(
'Route with an optional variable as the first segment',
array(
'/{bar}',
array(
'bar' => 'bar',
),
),
'',
'#^/(?P<bar>[^/]++)?$#s',
array(
'bar',
),
array(
array(
'variable',
'/',
'[^/]++',
'bar',
),
),
),
array(
'Route with a requirement of 0',
array(
'/{bar}',
array(
'bar' => null,
),
array(
'bar' => '0',
),
),
'',
'#^/(?P<bar>0)?$#s',
array(
'bar',
),
array(
array(
'variable',
'/',
'0',
'bar',
),
),
),
array(
'Route with an optional variable as the first segment with requirements',
array(
'/{bar}',
array(
'bar' => 'bar',
),
array(
'bar' => '(foo|bar)',
),
),
'',
'#^/(?P<bar>(foo|bar))?$#s',
array(
'bar',
),
array(
array(
'variable',
'/',
'(foo|bar)',
'bar',
),
),
),
array(
'Route with only optional variables',
array(
'/{foo}/{bar}',
array(
'foo' => 'foo',
'bar' => 'bar',
),
),
'',
'#^/(?P<foo>[^/]++)?(?:/(?P<bar>[^/]++))?$#s',
array(
'foo',
'bar',
),
array(
array(
'variable',
'/',
'[^/]++',
'bar',
),
array(
'variable',
'/',
'[^/]++',
'foo',
),
),
),
array(
'Route with a variable in last position',
array(
'/foo-{bar}',
),
'/foo',
'#^/foo\\-(?P<bar>[^/]++)$#s',
array(
'bar',
),
array(
array(
'variable',
'-',
'[^/]++',
'bar',
),
array(
'text',
'/foo',
),
),
),
array(
'Route with nested placeholders',
array(
'/{static{var}static}',
),
'/{static',
'#^/\\{static(?P<var>[^/]+)static\\}$#s',
array(
'var',
),
array(
array(
'text',
'static}',
),
array(
'variable',
'',
'[^/]+',
'var',
),
array(
'text',
'/{static',
),
),
),
array(
'Route without separator between variables',
array(
'/{w}{x}{y}{z}.{_format}',
array(
'z' => 'default-z',
'_format' => 'html',
),
array(
'y' => '(y|Y)',
),
),
'',
'#^/(?P<w>[^/\\.]+)(?P<x>[^/\\.]+)(?P<y>(y|Y))(?:(?P<z>[^/\\.]++)(?:\\.(?P<_format>[^/]++))?)?$#s',
array(
'w',
'x',
'y',
'z',
'_format',
),
array(
array(
'variable',
'.',
'[^/]++',
'_format',
),
array(
'variable',
'',
'[^/\\.]++',
'z',
),
array(
'variable',
'',
'(y|Y)',
'y',
),
array(
'variable',
'',
'[^/\\.]+',
'x',
),
array(
'variable',
'/',
'[^/\\.]+',
'w',
),
),
),
array(
'Route with a format',
array(
'/foo/{bar}.{_format}',
),
'/foo',
'#^/foo/(?P<bar>[^/\\.]++)\\.(?P<_format>[^/]++)$#s',
array(
'bar',
'_format',
),
array(
array(
'variable',
'.',
'[^/]++',
'_format',
),
array(
'variable',
'/',
'[^/\\.]++',
'bar',
),
array(
'text',
'/foo',
),
),
),
);
}