aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/includes/functions_url_matcher.php8
-rw-r--r--phpBB/phpbb/controller/provider.php7
-rw-r--r--tests/controller/controller_test.php2
-rw-r--r--tests/controller/ext/foo/config/routing.yml4
4 files changed, 12 insertions, 9 deletions
diff --git a/phpBB/includes/functions_url_matcher.php b/phpBB/includes/functions_url_matcher.php
index fdde302e3b..c5d6815119 100644
--- a/phpBB/includes/functions_url_matcher.php
+++ b/phpBB/includes/functions_url_matcher.php
@@ -32,7 +32,7 @@ function phpbb_get_url_matcher(\phpbb\extension\finder $finder, RequestContext $
{
if (defined('DEBUG'))
{
- return phpbb_create_url_matcher($finder, $context);
+ return phpbb_create_url_matcher($finder, $context, $root_path);
}
if (!phpbb_url_matcher_dumped($root_path, $php_ext))
@@ -54,7 +54,7 @@ function phpbb_get_url_matcher(\phpbb\extension\finder $finder, RequestContext $
function phpbb_create_dumped_url_matcher(\phpbb\extension\finder $finder, $root_path, $php_ext)
{
$provider = new \phpbb\controller\provider();
- $routes = $provider->import_paths_from_finder($finder)->find();
+ $routes = $provider->import_paths_from_finder($finder)->find($root_path);
$dumper = new PhpMatcherDumper($routes);
$cached_url_matcher_dump = $dumper->dump(array(
'class' => 'phpbb_url_matcher',
@@ -70,10 +70,10 @@ function phpbb_create_dumped_url_matcher(\phpbb\extension\finder $finder, $root_
* @param RequestContext $context Symfony RequestContext object
* @return UrlMatcher
*/
-function phpbb_create_url_matcher(\phpbb\extension\finder $finder, RequestContext $context)
+function phpbb_create_url_matcher(\phpbb\extension\finder $finder, RequestContext $context, $root_path)
{
$provider = new \phpbb\controller\provider();
- $routes = $provider->import_paths_from_finder($finder)->find();
+ $routes = $provider->import_paths_from_finder($finder)->find($root_path);
return new UrlMatcher($routes, $context);
}
diff --git a/phpBB/phpbb/controller/provider.php b/phpBB/phpbb/controller/provider.php
index 7ea0c973fe..048ca72084 100644
--- a/phpBB/phpbb/controller/provider.php
+++ b/phpBB/phpbb/controller/provider.php
@@ -56,8 +56,7 @@ class provider
// because the finder cannot find it
$this->routing_files = array_merge(array('config/routing.yml'), array_keys($finder
->directory('config')
- ->prefix('routing')
- ->suffix('.yml')
+ ->suffix('routing.yml')
->find()
));
@@ -75,8 +74,8 @@ class provider
$routes = new RouteCollection;
foreach ($this->routing_files as $file_path)
{
- $loader = new YamlFileLoader(new FileLocator(dirname($base_path . $file_path)));
- $routes->addCollection($loader->load(basename($file_path)));
+ $loader = new YamlFileLoader(new FileLocator($base_path));
+ $routes->addCollection($loader->load($file_path));
}
return $routes;
diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php
index 0e7cac05ec..c71fc92170 100644
--- a/tests/controller/controller_test.php
+++ b/tests/controller/controller_test.php
@@ -34,7 +34,7 @@ class phpbb_controller_controller_test extends phpbb_test_case
$provider = new \phpbb\controller\provider;
$routes = $provider
->import_paths_from_finder($this->extension_manager->get_finder())
- ->find('./tests/controller/');
+ ->find(__DIR__);
// This will need to be updated if any new routes are defined
$this->assertEquals(3, sizeof($routes));
diff --git a/tests/controller/ext/foo/config/routing.yml b/tests/controller/ext/foo/config/routing.yml
index 4799fec37d..6cc275d96d 100644
--- a/tests/controller/ext/foo/config/routing.yml
+++ b/tests/controller/ext/foo/config/routing.yml
@@ -1,3 +1,7 @@
controller1:
pattern: /foo
defaults: { _controller: foo.controller:handle }
+
+include_controller2:
+ resource: "routing_2.yml"
+ prefix: /foo