diff options
Diffstat (limited to 'tests/controller')
-rw-r--r-- | tests/controller/common_helper_route.php | 8 | ||||
-rw-r--r-- | tests/controller/controller_test.php | 11 |
2 files changed, 12 insertions, 7 deletions
diff --git a/tests/controller/common_helper_route.php b/tests/controller/common_helper_route.php index 4c0c8569a3..72c5328b0b 100644 --- a/tests/controller/common_helper_route.php +++ b/tests/controller/common_helper_route.php @@ -122,9 +122,11 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case ) ); - $this->router = new phpbb_mock_router($container, $this->filesystem, dirname(__FILE__) . '/', 'php', PHPBB_ENVIRONMENT, $this->extension_manager); - $this->router->find_routing_files($this->extension_manager->all_enabled(false)); - $this->router->find(dirname(__FILE__) . '/'); + $loader = new \Symfony\Component\Routing\Loader\YamlFileLoader( + new \phpbb\routing\file_locator($this->filesystem, dirname(__FILE__) . '/') + ); + $resources_locator = new \phpbb\routing\resources_locator\default_resources_locator(dirname(__FILE__) . '/', PHPBB_ENVIRONMENT, $this->extension_manager); + $this->router = new phpbb_mock_router($container, $resources_locator, $loader, dirname(__FILE__) . '/', 'php', PHPBB_ENVIRONMENT); // Set correct current phpBB root path $this->root_path = $this->get_phpbb_root_path(); diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index d0295d66bc..431b26b2bc 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -38,14 +38,17 @@ class phpbb_controller_controller_test extends phpbb_test_case )); } - public function test_router_find_files() + public function test_router_default_loader() { $container = new phpbb_mock_container_builder(); $container->setParameter('core.environment', PHPBB_ENVIRONMENT); - $router = new \phpbb\routing\router($container, new \phpbb\filesystem\filesystem(), dirname(__FILE__) . '/', 'php', PHPBB_ENVIRONMENT, $this->extension_manager); - $router->find_routing_files($this->extension_manager->all_enabled(false)); - $routes = $router->find(__DIR__)->get_routes(); + $loader = new \Symfony\Component\Routing\Loader\YamlFileLoader( + new \phpbb\routing\file_locator(new \phpbb\filesystem\filesystem(), dirname(__FILE__) . '/') + ); + $resources_locator = new \phpbb\routing\resources_locator\default_resources_locator(dirname(__FILE__) . '/', PHPBB_ENVIRONMENT, $this->extension_manager); + $router = new phpbb_mock_router($container, $resources_locator, $loader, dirname(__FILE__) . '/', 'php', PHPBB_ENVIRONMENT); + $routes = $router->get_routes(); // This will need to be updated if any new routes are defined $this->assertInstanceOf('Symfony\Component\Routing\Route', $routes->get('core_controller')); |