@@ 19-36 (lines=18) @@ | ||
16 | class LoaderTraitTest extends AbstractTest |
|
17 | { |
|
18 | ||
19 | public function test_registerLoader() |
|
20 | { |
|
21 | $container = new Container(); |
|
22 | $container->set('app', new Application()); |
|
23 | ||
24 | $provider = new RouterServiceProvider(); |
|
25 | $provider->setContainer($container); |
|
26 | $provider->registerLoader(); |
|
27 | ||
28 | $loader = $container->get('routing.loader'); |
|
29 | self::assertInstanceOf(DelegatingLoader::class, $loader); |
|
30 | ||
31 | /** @var RouteCollection $collection */ |
|
32 | $collection = $loader->load('routes.php'); |
|
33 | self::assertInstanceOf(RouteCollection::class, $collection); |
|
34 | self::assertCount(8, $collection); |
|
35 | self::assertTrue($collection->has('admin.index')); |
|
36 | } |
|
37 | } |
|
38 |
@@ 20-36 (lines=17) @@ | ||
17 | */ |
|
18 | class RouterTraitTest extends AbstractTest |
|
19 | { |
|
20 | public function testRegisterRouter() |
|
21 | { |
|
22 | $container = new Container(); |
|
23 | $container->set('app', new Application()); |
|
24 | ||
25 | $provider = new RouterServiceProvider(); |
|
26 | $provider->setContainer($container); |
|
27 | $provider->register(); |
|
28 | ||
29 | /** @var Router $router */ |
|
30 | $router = $container->get('router'); |
|
31 | self::assertInstanceOf(Router::class, $router); |
|
32 | ||
33 | $generator = $router->getGenerator(); |
|
34 | self::assertInstanceOf(CompiledUrlGenerator::class, $generator); |
|
35 | self::assertTrue($generator->hasRoute('default.standard')); |
|
36 | } |
|
37 | ||
38 | public function testRegisterCustomRouter() |
|
39 | { |