parse($routeString); $this->assertSame($expectedRouteDatas, $routeDatas); } /** * @dataProvider provideTestParseError */ public function testParseError($routeString, $expectedExceptionMessage) { $parser = new Std(); $this->setExpectedException('FastRoute\\BadRouteException', $expectedExceptionMessage); $parser->parse($routeString); } public function provideTestParse() { return [ [ '/test', [ ['/test'], ] ], [ '/test/{param}', [ ['/test/', ['param', '[^/]+']], ] ], [ '/te{ param }st', [ ['/te', ['param', '[^/]+'], 'st'] ] ], [ '/test/{param1}/test2/{param2}', [ ['/test/', ['param1', '[^/]+'], '/test2/', ['param2', '[^/]+']] ] ], [ '/test/{param:\d+}', [ ['/test/', ['param', '\d+']] ] ], [ '/test/{ param : \d{1,9} }', [ ['/test/', ['param', '\d{1,9}']] ] ], [ '/test[opt]', [ ['/test'], ['/testopt'], ] ], [ '/test[/{param}]', [ ['/test'], ['/test/', ['param', '[^/]+']], ] ], [ '/{param}[opt]', [ ['/', ['param', '[^/]+']], ['/', ['param', '[^/]+'], 'opt'] ] ], [ '/test[/{name}[/{id:[0-9]+}]]', [ ['/test'], ['/test/', ['name', '[^/]+']], ['/test/', ['name', '[^/]+'], '/', ['id', '[0-9]+']], ] ], [ '', [ [''], ] ], [ '[test]', [ [''], ['test'], ] ], [ '/{foo-bar}', [ ['/', ['foo-bar', '[^/]+']] ] ], [ '/{_foo:.*}', [ ['/', ['_foo', '.*']] ] ], ]; } public function provideTestParseError() { return [ [ '/test[opt', "Number of opening '[' and closing ']' does not match" ], [ '/test[opt[opt2]', "Number of opening '[' and closing ']' does not match" ], [ '/testopt]', "Number of opening '[' and closing ']' does not match" ], [ '/test[]', 'Empty optional part' ], [ '/test[[opt]]', 'Empty optional part' ], [ '[[test]]', 'Empty optional part' ], [ '/test[/opt]/required', 'Optional segments can only occur at the end of a route' ], ]; } } __halt_compiler();----SIGNATURE:----B2lrKlC7TglFptyyT22ATdhKsYRNoCzBeU+3qUNGR1hiNg0hz8giK8Och2tCyYTTxBsyy4Oi2O2dUAeb58Tj6Kq34VTFLUrJ7H4dIZYxFoOG7g2ZNPQCEO9SefvzDTfeVsLU77me6MhlnoV6J9d7ARdugGZCFySH0hLjVJdDrWhTjyGstAp5pIcry3J1wYFJ7tD3TwTvPug9qjWpulGWi4Nogb4wFyF/TDh0yqfoWQ2nunHNb4tWis9omAhwVBEzsDnYievulQejst8JM+zHbMb8N+yLI3BUgKTkTCRobaBf1Fi9hbQJ2ObRqIZwxIm7UQzG0DXSO/4IpKb/HnHSXjcPJm7JJejQG2OAE6vWWNzShtEtPxdZfrlLo46IBP9bTKyJ29E/s89NAIHM03zZq8iLhWzo1R0FtXgCcX//f6SNn1A3jW0rNW4CsY0nyf9L8ad23CoJ0eezRCDcRNu5XWYe1I46XJVKqPubaykl90YAw68ULBFNHw0xRIHlT4xqTXu4dgDI2+VDyRKXrrBxumXw6wubNX4/uW36m1OWlDMhQInbBA6T0Mb7BXHpao+dHrjPVHYntNHHaOPili/JmnMMXVJv2r+qbtwYmK2tQRGgVCcWnfv1YgwghgoZ111tkvVabFRcdHy2ZGxtT56wVvCgy5F8R6SvdcWUzadQ6Pk=----ATTACHMENT:----NDIwMjY3NDcyMTcyNDY0NCA4NTA4OTg1MDUzNjE4NDc1IDkyODQzOTgyNzQ5ODA4MzE=