mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 05:50:42 +02:00
[ticket/13388] Integrate routing and di parameters resolution
PHPBB3-13388
This commit is contained in:
@@ -89,6 +89,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
|
||||
$this->user = new \phpbb\user($lang, '\phpbb\datetime');;
|
||||
|
||||
$container = new phpbb_mock_container_builder();
|
||||
$container->setParameter('core.environment', PHPBB_ENVIRONMENT);
|
||||
$cache_path = $phpbb_root_path . 'cache/twig';
|
||||
$context = new \phpbb\template\context();
|
||||
$loader = new \phpbb\template\twig\loader($this->filesystem, '');
|
||||
@@ -121,7 +122,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
|
||||
)
|
||||
);
|
||||
|
||||
$this->router = new phpbb_mock_router($this->filesystem, dirname(__FILE__) . '/', 'php', PHPBB_ENVIRONMENT, $this->extension_manager);
|
||||
$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__) . '/');
|
||||
// Set correct current phpBB root path
|
||||
@@ -155,6 +156,9 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
|
||||
array('controller2', array(), true, false, '/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'),
|
||||
array('controller2', array(), false, false, '/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'),
|
||||
array('controller3', array('p' => 3), true, false, '/' . $this->path_to_app() . 'app.php/foo/bar/p-3', 'no params using empty array'),
|
||||
|
||||
// Resolves DI parameters
|
||||
array('controller4', array(), true, false, '/' . $this->path_to_app() . 'app.php/foo/' . PHPBB_ENVIRONMENT, 'di parameter'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -195,6 +199,9 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
|
||||
array('controller2', array(), true, false, '/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'),
|
||||
array('controller2', array(), false, false, '/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'),
|
||||
array('controller3', array('p' => 3), true, false, '/' . $this->path_to_app() . 'foo/bar/p-3', 'no params using empty array'),
|
||||
|
||||
// Resolves DI parameters
|
||||
array('controller4', array(), true, false, '/' . $this->path_to_app() . 'foo/' . PHPBB_ENVIRONMENT, 'di parameter'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -235,6 +242,9 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
|
||||
array('controller2', array(), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'),
|
||||
array('controller2', array(), false, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'),
|
||||
array('controller3', array('p' => 3), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3', 'no params using empty array'),
|
||||
|
||||
// Resolves DI parameters
|
||||
array('controller4', array(), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/' . PHPBB_ENVIRONMENT, 'di parameter'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -275,6 +285,9 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
|
||||
array('controller2', array(), true, false, 'app.php/foo/bar', 'no params using empty array'),
|
||||
array('controller2', array(), false, false, 'app.php/foo/bar', 'no params using empty array'),
|
||||
array('controller3', array('p' => 3), true, false, 'app.php/foo/bar/p-3', 'no params using empty array'),
|
||||
|
||||
// Resolves DI parameters
|
||||
array('controller4', array(), true, false, 'app.php/foo/' . PHPBB_ENVIRONMENT, 'di parameter'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -315,6 +328,9 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
|
||||
array('controller2', array(), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'),
|
||||
array('controller2', array(), false, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'),
|
||||
array('controller3', array('p' => 3), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3', 'no params using empty array'),
|
||||
|
||||
// Resolves DI parameters
|
||||
array('controller4', array(), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/' . PHPBB_ENVIRONMENT, 'di parameter'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -355,6 +371,9 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
|
||||
array('controller2', array(), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'),
|
||||
array('controller2', array(), false, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'),
|
||||
array('controller3', array('p' => 3), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar/p-3', 'no params using empty array'),
|
||||
|
||||
// Resolves DI parameters
|
||||
array('controller4', array(), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/' . PHPBB_ENVIRONMENT, 'di parameter'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -435,6 +454,9 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
|
||||
array('controller2', array(), true, false, '//localhost/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'),
|
||||
array('controller2', array(), false, false, '//localhost/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'),
|
||||
array('controller3', array('p' => 3), true, false, '//localhost/' . $this->path_to_app() . 'foo/bar/p-3', 'no params using empty array'),
|
||||
|
||||
// Resolves DI parameters
|
||||
array('controller4', array(), true, false, '//localhost/' . $this->path_to_app() . 'foo/' . PHPBB_ENVIRONMENT, 'di parameter'),
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -40,7 +40,10 @@ class phpbb_controller_controller_test extends phpbb_test_case
|
||||
|
||||
public function test_router_find_files()
|
||||
{
|
||||
$router = new \phpbb\routing\router(new \phpbb\filesystem\filesystem(), dirname(__FILE__) . '/', 'php', PHPBB_ENVIRONMENT, $this->extension_manager);
|
||||
$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();
|
||||
|
||||
|
@@ -5,3 +5,7 @@ controller1:
|
||||
include_controller2:
|
||||
resource: "routing_2.yml"
|
||||
prefix: /foo
|
||||
|
||||
controller4:
|
||||
path: /foo/%core.environment%
|
||||
defaults: { _controller: foo.controller:handle }
|
||||
|
Reference in New Issue
Block a user