예제 #1
0
 public function testUnknownRoute()
 {
     $this->expectException(\LogicException::class);
     $this->expectExceptionMessage('Unknown route: unknown');
     $router = Router::createDefault();
     $url_builder = new UrlBuilder($router);
     $uri = \Yen\Http\Uri::createFromString('route:unknown');
     $url_builder->build($uri);
 }
예제 #2
0
 public function testDuplicateRouteNameException()
 {
     $this->expectException(\LogicException::class);
     $this->expectExceptionMessage('Route with name "test" already added');
     $rules = ['@test /test/:foo => test/info', '@fzz /fzz => test/fzz', '@test /foobar => /foo/bar', '/* => $uri'];
     $vfs = new \MicroVFS\Container();
     $vfs->set('router.rules', implode("\n", $rules));
     \MicroVFS\StreamWrapper::register('mvfs', $vfs);
     $router = Router::createFromRoutesFile('mvfs://router.rules');
 }