From dc6e2be884fdb8d869e7da03984014fd18e30ae2 Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Fri, 2 May 2014 23:03:03 +0200 Subject: [PATCH 1/9] [ticket/11497] Remove 'ext.finder' from services' list PHPBB3-11497 --- phpBB/config/services.yml | 15 ++-------- phpBB/includes/functions_url_matcher.php | 22 ++++++++------- phpBB/phpbb/controller/helper.php | 4 ++- phpBB/phpbb/controller/provider.php | 26 +++++++++-------- .../phpbb/event/kernel_request_subscriber.php | 15 +++++----- tests/controller/controller_test.php | 3 +- tests/controller/helper_route_test.php | 28 ++++++++++--------- tests/pagination/pagination_test.php | 8 ++++-- 8 files changed, 62 insertions(+), 59 deletions(-) diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index 90a2f3b187..fdd8a33135 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -95,6 +95,7 @@ services: - @user - @config - @controller.provider + - @ext.manager - %core.root_path% - %core.php_ext% @@ -107,8 +108,6 @@ services: controller.provider: class: phpbb\controller\provider - arguments: - - @ext.finder calls: - [find, [%core.root_path%]] @@ -175,16 +174,6 @@ services: - %core.php_ext% - @cache.driver - ext.finder: - class: phpbb\extension\finder - arguments: - - @ext.manager - - @filesystem - - %core.root_path% - - @cache.driver - - %core.php_ext% - - _ext_finder - filesystem: class: phpbb\filesystem @@ -217,7 +206,7 @@ services: kernel_request_subscriber: class: phpbb\event\kernel_request_subscriber arguments: - - @ext.finder + - @ext.manager - %core.root_path% - %core.php_ext% tags: diff --git a/phpBB/includes/functions_url_matcher.php b/phpBB/includes/functions_url_matcher.php index 8e5ae20f93..bc91a38012 100644 --- a/phpBB/includes/functions_url_matcher.php +++ b/phpBB/includes/functions_url_matcher.php @@ -22,22 +22,22 @@ if (!defined('IN_PHPBB')) /** * Create a new UrlMatcher class and dump it into the cache file * -* @param \phpbb\extension\finder $finder Extension finder +* @param \phpbb\extension\manager $manager Extension manager * @param RequestContext $context Symfony RequestContext object * @param string $root_path Root path * @param string $php_ext PHP extension * @return null */ -function phpbb_get_url_matcher(\phpbb\extension\finder $finder, RequestContext $context, $root_path, $php_ext) +function phpbb_get_url_matcher(\phpbb\extension\manager $manager, RequestContext $context, $root_path, $php_ext) { if (defined('DEBUG')) { - return phpbb_create_url_matcher($finder, $context, $root_path); + return phpbb_create_url_matcher($manager, $context, $root_path); } if (!phpbb_url_matcher_dumped($root_path, $php_ext)) { - phpbb_create_dumped_url_matcher($finder, $root_path, $php_ext); + phpbb_create_dumped_url_matcher($manager, $root_path, $php_ext); } return phpbb_load_url_matcher($context, $root_path, $php_ext); @@ -46,14 +46,15 @@ function phpbb_get_url_matcher(\phpbb\extension\finder $finder, RequestContext $ /** * Create a new UrlMatcher class and dump it into the cache file * -* @param \phpbb\extension\finder $finder Extension finder +* @param \phpbb\extension\manager $manager Extension manager * @param string $root_path Root path * @param string $php_ext PHP extension * @return null */ -function phpbb_create_dumped_url_matcher(\phpbb\extension\finder $finder, $root_path, $php_ext) +function phpbb_create_dumped_url_matcher(\phpbb\extension\manager $manager, $root_path, $php_ext) { - $provider = new \phpbb\controller\provider($finder); + $provider = new \phpbb\controller\provider(); + $provider->set_ext_finder($manager->get_finder()); $routes = $provider->find($root_path)->get_routes(); $dumper = new PhpMatcherDumper($routes); $cached_url_matcher_dump = $dumper->dump(array( @@ -66,13 +67,14 @@ function phpbb_create_dumped_url_matcher(\phpbb\extension\finder $finder, $root_ /** * Create a non-cached UrlMatcher * -* @param \phpbb\extension\finder $finder Extension finder +* @param \phpbb\extension\manager $manager Extension manager * @param RequestContext $context Symfony RequestContext object * @return UrlMatcher */ -function phpbb_create_url_matcher(\phpbb\extension\finder $finder, RequestContext $context, $root_path) +function phpbb_create_url_matcher(\phpbb\extension\manager $manager, RequestContext $context, $root_path) { - $provider = new \phpbb\controller\provider($finder); + $provider = new \phpbb\controller\provider(); + $provider->set_ext_finder($manager->get_finder()); $routes = $provider->find($root_path)->get_routes(); return new UrlMatcher($routes, $context); } diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php index 54c30c93fc..9f9f45d730 100644 --- a/phpBB/phpbb/controller/helper.php +++ b/phpBB/phpbb/controller/helper.php @@ -56,16 +56,18 @@ class helper * @param \phpbb\user $user User object * @param \phpbb\config\config $config Config object * @param \phpbb\controller\provider $provider Path provider + * @param \phpbb\extension\manager $manager Extension manager object * @param string $phpbb_root_path phpBB root path * @param string $php_ext PHP extension */ - public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\config\config $config, \phpbb\controller\provider $provider, $phpbb_root_path, $php_ext) + public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\config\config $config, \phpbb\controller\provider $provider, \phpbb\extension\manager $manager, $phpbb_root_path, $php_ext) { $this->template = $template; $this->user = $user; $this->config = $config; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; + $provider->set_ext_finder($manager->get_finder()); $this->route_collection = $provider->get_routes(); } diff --git a/phpBB/phpbb/controller/provider.php b/phpBB/phpbb/controller/provider.php index 2c7493f64c..7e33db1f74 100644 --- a/phpBB/phpbb/controller/provider.php +++ b/phpBB/phpbb/controller/provider.php @@ -37,20 +37,24 @@ class provider * @param array() $routing_files Array of strings containing paths * to YAML files holding route information */ - public function __construct(\phpbb\extension\finder $finder = null, $routing_files = array()) + public function __construct($routing_files = array()) { $this->routing_files = $routing_files; + } - if ($finder) - { - // We hardcode the path to the core config directory - // because the finder cannot find it - $this->routing_files = array_merge($this->routing_files, array('config/routing.yml'), array_keys($finder - ->directory('/config') - ->suffix('routing.yml') - ->find() - )); - } + /** + * @param \phpbb\extension\finder $finder + * @return null + */ + public function set_ext_finder(\phpbb\extension\finder $finder) + { + // We hardcode the path to the core config directory + // because the finder cannot find it + $this->routing_files = array_merge($this->routing_files, array('config/routing.yml'), array_keys($finder + ->directory('config') + ->suffix('routing.yml') + ->find() + )); } /** diff --git a/phpBB/phpbb/event/kernel_request_subscriber.php b/phpBB/phpbb/event/kernel_request_subscriber.php index 7d5418498b..a39d622273 100644 --- a/phpBB/phpbb/event/kernel_request_subscriber.php +++ b/phpBB/phpbb/event/kernel_request_subscriber.php @@ -18,10 +18,10 @@ use Symfony\Component\Routing\RequestContext; class kernel_request_subscriber implements EventSubscriberInterface { /** - * Extension finder object - * @var \phpbb\extension\finder + * Extension manager object + * @var \phpbb\extension\manager */ - protected $finder; + protected $manager; /** * PHP extension @@ -38,15 +38,15 @@ class kernel_request_subscriber implements EventSubscriberInterface /** * Construct method * - * @param \phpbb\extension\finder $finder Extension finder object + * @param \phpbb\extension\manager $manager Extension manager object * @param string $root_path Root path * @param string $php_ext PHP extension */ - public function __construct(\phpbb\extension\finder $finder, $root_path, $php_ext) + public function __construct(\phpbb\extension\manager $manager, $root_path, $php_ext) { - $this->finder = $finder; $this->root_path = $root_path; $this->php_ext = $php_ext; + $this->manager = $manager; } /** @@ -55,6 +55,7 @@ class kernel_request_subscriber implements EventSubscriberInterface * This is responsible for setting up the routing information * * @param GetResponseEvent $event + * @throws \BadMethodCallException * @return null */ public function on_kernel_request(GetResponseEvent $event) @@ -63,7 +64,7 @@ class kernel_request_subscriber implements EventSubscriberInterface $context = new RequestContext(); $context->fromRequest($request); - $matcher = phpbb_get_url_matcher($this->finder, $context, $this->root_path, $this->php_ext); + $matcher = phpbb_get_url_matcher($this->manager, $context, $this->root_path, $this->php_ext); $router_listener = new RouterListener($matcher, $context); $router_listener->onKernelRequest($event); } diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index 7d9fe652eb..c6d58d70ab 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -29,7 +29,8 @@ class phpbb_controller_controller_test extends phpbb_test_case public function test_provider() { - $provider = new \phpbb\controller\provider($this->extension_manager->get_finder()); + $provider = new \phpbb\controller\provider(); + $provider->set_ext_finder($this->extension_manager->get_finder()); $routes = $provider->find(__DIR__)->get_routes(); // This will need to be updated if any new routes are defined diff --git a/tests/controller/helper_route_test.php b/tests/controller/helper_route_test.php index 5264c788c7..e40fa280da 100644 --- a/tests/controller/helper_route_test.php +++ b/tests/controller/helper_route_test.php @@ -27,23 +27,25 @@ class phpbb_controller_helper_route_test extends phpbb_test_case ); $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '0')); $this->template = new phpbb\template\twig\twig($phpbb_path_helper, $this->config, $this->user, new \phpbb\template\context()); + $this->extension_manager = new phpbb_mock_extension_manager( + dirname(__FILE__) . '/', + array( + 'vendor2/foo' => array( + 'ext_name' => 'vendor2/foo', + 'ext_active' => '1', + 'ext_path' => 'ext/vendor2/foo/', + ), + ) + ); $finder = new \phpbb\extension\finder( - new phpbb_mock_extension_manager( - dirname(__FILE__) . '/', - array( - 'vendor2/foo' => array( - 'ext_name' => 'vendor2/foo', - 'ext_active' => '1', - 'ext_path' => 'ext/vendor2/foo/', - ), - ) - ), + $this->extension_manager, new \phpbb\filesystem(), dirname(__FILE__) . '/', new phpbb_mock_cache() ); - $this->provider = new \phpbb\controller\provider($finder); + $this->provider = new \phpbb\controller\provider(); + $this->provider->set_ext_finder($finder); $this->provider->find(dirname(__FILE__) . '/'); } @@ -82,7 +84,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case */ public function test_helper_url_no_rewrite($route, $params, $is_amp, $session_id, $expected, $description) { - $this->helper = new \phpbb\controller\helper($this->template, $this->user, $this->config, $this->provider, '', 'php'); + $this->helper = new \phpbb\controller\helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager,'', 'php'); $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id)); } @@ -122,7 +124,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case public function test_helper_url_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description) { $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1')); - $this->helper = new \phpbb\controller\helper($this->template, $this->user, $this->config, $this->provider, '', 'php'); + $this->helper = new \phpbb\controller\helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager,'', 'php'); $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id)); } } diff --git a/tests/pagination/pagination_test.php b/tests/pagination/pagination_test.php index 71206dff58..696bd3f33f 100644 --- a/tests/pagination/pagination_test.php +++ b/tests/pagination/pagination_test.php @@ -30,17 +30,19 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case ->method('lang') ->will($this->returnCallback(array($this, 'return_callback_implode'))); + $manager = new phpbb_mock_extension_manager(dirname(__FILE__) . '/', array()); $this->finder = new \phpbb\extension\finder( - new phpbb_mock_extension_manager(dirname(__FILE__) . '/', array()), + $manager, new \phpbb\filesystem(), dirname(__FILE__) . '/', new phpbb_mock_cache() ); $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1')); - $provider = new \phpbb\controller\provider($this->finder); + $provider = new \phpbb\controller\provider(); + $this->provider->set_ext_finder($this->finder); $provider->find(dirname(__FILE__) . '/'); - $this->helper = new \phpbb\controller\helper($this->template, $this->user, $this->config, $provider, '', 'php'); + $this->helper = new \phpbb\controller\helper($this->template, $this->user, $this->config, $provider, $manager, '', 'php'); $this->pagination = new \phpbb\pagination($this->template, $this->user, $this->helper); } From 24634668260db2e64c61e48c54c98c1ab4087020 Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Sat, 3 May 2014 11:36:05 +0200 Subject: [PATCH 2/9] [ticket/11497] Update pagination test PHPBB3-11497 --- tests/pagination/pagination_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pagination/pagination_test.php b/tests/pagination/pagination_test.php index 696bd3f33f..be898de9b7 100644 --- a/tests/pagination/pagination_test.php +++ b/tests/pagination/pagination_test.php @@ -40,7 +40,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1')); $provider = new \phpbb\controller\provider(); - $this->provider->set_ext_finder($this->finder); + $this->provider->set_ext_finder($manager->get_finder()); $provider->find(dirname(__FILE__) . '/'); $this->helper = new \phpbb\controller\helper($this->template, $this->user, $this->config, $provider, $manager, '', 'php'); $this->pagination = new \phpbb\pagination($this->template, $this->user, $this->helper); From 01e19a00f8107698ed1c6868398cbbf0ac2ab7d8 Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Sat, 3 May 2014 11:44:58 +0200 Subject: [PATCH 3/9] [ticket/11497] Fix tests PHPBB3-11497 --- tests/pagination/pagination_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pagination/pagination_test.php b/tests/pagination/pagination_test.php index be898de9b7..bf8729e4f8 100644 --- a/tests/pagination/pagination_test.php +++ b/tests/pagination/pagination_test.php @@ -40,7 +40,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1')); $provider = new \phpbb\controller\provider(); - $this->provider->set_ext_finder($manager->get_finder()); + $provider->set_ext_finder($this->finder); $provider->find(dirname(__FILE__) . '/'); $this->helper = new \phpbb\controller\helper($this->template, $this->user, $this->config, $provider, $manager, '', 'php'); $this->pagination = new \phpbb\pagination($this->template, $this->user, $this->helper); From e920f146ca10185064c5dfc7dcc3f45704e833e3 Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Sat, 3 May 2014 12:24:07 +0200 Subject: [PATCH 4/9] [ticket/11497] Fix the path for the finder in controller_provider PHPBB3-11497 --- phpBB/phpbb/controller/provider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/controller/provider.php b/phpBB/phpbb/controller/provider.php index 7e33db1f74..287cb44593 100644 --- a/phpBB/phpbb/controller/provider.php +++ b/phpBB/phpbb/controller/provider.php @@ -51,7 +51,7 @@ class provider // We hardcode the path to the core config directory // because the finder cannot find it $this->routing_files = array_merge($this->routing_files, array('config/routing.yml'), array_keys($finder - ->directory('config') + ->directory('/config') ->suffix('routing.yml') ->find() )); From 0d893d65eb2823aae449a9201941798e450a9be1 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sat, 3 May 2014 13:41:32 +0200 Subject: [PATCH 5/9] [ticket/11497] Generate the list of the routes in controller_helper PHPBB3-11497 --- phpBB/phpbb/controller/helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php index 9f9f45d730..ab3e3b3556 100644 --- a/phpBB/phpbb/controller/helper.php +++ b/phpBB/phpbb/controller/helper.php @@ -68,7 +68,7 @@ class helper $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; $provider->set_ext_finder($manager->get_finder()); - $this->route_collection = $provider->get_routes(); + $this->route_collection = $provider->find('./')->get_routes(); } /** From 8d9133a30e576d9f4315bc914b56c7be5481ebf4 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sat, 3 May 2014 14:00:47 +0200 Subject: [PATCH 6/9] [ticket/11497] Use a mock object to define the root folder for the finder PHPBB3-11497 --- phpBB/phpbb/controller/helper.php | 2 +- tests/controller/helper_route_test.php | 4 ++-- tests/mock/controller_helper.php | 22 ++++++++++++++++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 tests/mock/controller_helper.php diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php index ab3e3b3556..9f1a3864ef 100644 --- a/phpBB/phpbb/controller/helper.php +++ b/phpBB/phpbb/controller/helper.php @@ -68,7 +68,7 @@ class helper $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; $provider->set_ext_finder($manager->get_finder()); - $this->route_collection = $provider->find('./')->get_routes(); + $this->route_collection = $provider->find($phpbb_root_path)->get_routes(); } /** diff --git a/tests/controller/helper_route_test.php b/tests/controller/helper_route_test.php index e40fa280da..c633df7c38 100644 --- a/tests/controller/helper_route_test.php +++ b/tests/controller/helper_route_test.php @@ -84,7 +84,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case */ public function test_helper_url_no_rewrite($route, $params, $is_amp, $session_id, $expected, $description) { - $this->helper = new \phpbb\controller\helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager,'', 'php'); + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, '', 'php', dirname(__FILE__) . '/'); $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id)); } @@ -124,7 +124,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case public function test_helper_url_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description) { $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1')); - $this->helper = new \phpbb\controller\helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager,'', 'php'); + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $this->provider, $this->extension_manager, '', 'php', dirname(__FILE__) . '/'); $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id)); } } diff --git a/tests/mock/controller_helper.php b/tests/mock/controller_helper.php new file mode 100644 index 0000000000..c53d7265c4 --- /dev/null +++ b/tests/mock/controller_helper.php @@ -0,0 +1,22 @@ +template = $template; + $this->user = $user; + $this->config = $config; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $provider->set_ext_finder($manager->get_finder()); + $this->route_collection = $provider->find($phpbb_root_path_ext)->get_routes(); + } +} From 5cb68b6be99a001c7df2732c71e468d8c4e91fc9 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sat, 3 May 2014 14:07:49 +0200 Subject: [PATCH 7/9] [ticket/11497] Fix pagination tests PHPBB3-11497 --- tests/pagination/pagination_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pagination/pagination_test.php b/tests/pagination/pagination_test.php index bf8729e4f8..13b31779c0 100644 --- a/tests/pagination/pagination_test.php +++ b/tests/pagination/pagination_test.php @@ -42,7 +42,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case $provider = new \phpbb\controller\provider(); $provider->set_ext_finder($this->finder); $provider->find(dirname(__FILE__) . '/'); - $this->helper = new \phpbb\controller\helper($this->template, $this->user, $this->config, $provider, $manager, '', 'php'); + $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $provider, $manager, '', 'php', dirname(__FILE__) . '/'); $this->pagination = new \phpbb\pagination($this->template, $this->user, $this->helper); } From 78e1d119f5b1f92da8ffe068d947035b6f5305ea Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sat, 3 May 2014 19:16:40 +0200 Subject: [PATCH 8/9] [ticket/11497] Change the date in the package declaration PHPBB3-11497 --- tests/mock/controller_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/mock/controller_helper.php b/tests/mock/controller_helper.php index c53d7265c4..d46d89b367 100644 --- a/tests/mock/controller_helper.php +++ b/tests/mock/controller_helper.php @@ -2,7 +2,7 @@ /** * * @package testing -* @copyright (c) 2011 phpBB Group +* @copyright (c) 2014 phpBB Group * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ From 346c6f39980fe060b57549a8364f2e5dece1eb83 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 5 May 2014 18:20:14 +0200 Subject: [PATCH 9/9] [ticket/11497] Rename set_ext_finder in find_routing_files PHPBB3-11497 --- phpBB/includes/functions_url_matcher.php | 4 ++-- phpBB/phpbb/controller/helper.php | 2 +- phpBB/phpbb/controller/provider.php | 2 +- tests/controller/controller_test.php | 2 +- tests/controller/helper_route_test.php | 2 +- tests/mock/controller_helper.php | 2 +- tests/pagination/pagination_test.php | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/functions_url_matcher.php b/phpBB/includes/functions_url_matcher.php index bc91a38012..cdbe60595c 100644 --- a/phpBB/includes/functions_url_matcher.php +++ b/phpBB/includes/functions_url_matcher.php @@ -54,7 +54,7 @@ function phpbb_get_url_matcher(\phpbb\extension\manager $manager, RequestContext function phpbb_create_dumped_url_matcher(\phpbb\extension\manager $manager, $root_path, $php_ext) { $provider = new \phpbb\controller\provider(); - $provider->set_ext_finder($manager->get_finder()); + $provider->find_routing_files($manager->get_finder()); $routes = $provider->find($root_path)->get_routes(); $dumper = new PhpMatcherDumper($routes); $cached_url_matcher_dump = $dumper->dump(array( @@ -74,7 +74,7 @@ function phpbb_create_dumped_url_matcher(\phpbb\extension\manager $manager, $roo function phpbb_create_url_matcher(\phpbb\extension\manager $manager, RequestContext $context, $root_path) { $provider = new \phpbb\controller\provider(); - $provider->set_ext_finder($manager->get_finder()); + $provider->find_routing_files($manager->get_finder()); $routes = $provider->find($root_path)->get_routes(); return new UrlMatcher($routes, $context); } diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php index 9f1a3864ef..959a24f277 100644 --- a/phpBB/phpbb/controller/helper.php +++ b/phpBB/phpbb/controller/helper.php @@ -67,7 +67,7 @@ class helper $this->config = $config; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; - $provider->set_ext_finder($manager->get_finder()); + $provider->find_routing_files($manager->get_finder()); $this->route_collection = $provider->find($phpbb_root_path)->get_routes(); } diff --git a/phpBB/phpbb/controller/provider.php b/phpBB/phpbb/controller/provider.php index 287cb44593..a32ce1473b 100644 --- a/phpBB/phpbb/controller/provider.php +++ b/phpBB/phpbb/controller/provider.php @@ -46,7 +46,7 @@ class provider * @param \phpbb\extension\finder $finder * @return null */ - public function set_ext_finder(\phpbb\extension\finder $finder) + public function find_routing_files(\phpbb\extension\finder $finder) { // We hardcode the path to the core config directory // because the finder cannot find it diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php index c6d58d70ab..7b8b78dd22 100644 --- a/tests/controller/controller_test.php +++ b/tests/controller/controller_test.php @@ -30,7 +30,7 @@ class phpbb_controller_controller_test extends phpbb_test_case public function test_provider() { $provider = new \phpbb\controller\provider(); - $provider->set_ext_finder($this->extension_manager->get_finder()); + $provider->find_routing_files($this->extension_manager->get_finder()); $routes = $provider->find(__DIR__)->get_routes(); // This will need to be updated if any new routes are defined diff --git a/tests/controller/helper_route_test.php b/tests/controller/helper_route_test.php index c633df7c38..ae6f924a62 100644 --- a/tests/controller/helper_route_test.php +++ b/tests/controller/helper_route_test.php @@ -45,7 +45,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case new phpbb_mock_cache() ); $this->provider = new \phpbb\controller\provider(); - $this->provider->set_ext_finder($finder); + $this->provider->find_routing_files($finder); $this->provider->find(dirname(__FILE__) . '/'); } diff --git a/tests/mock/controller_helper.php b/tests/mock/controller_helper.php index d46d89b367..01ac6494d0 100644 --- a/tests/mock/controller_helper.php +++ b/tests/mock/controller_helper.php @@ -16,7 +16,7 @@ class phpbb_mock_controller_helper extends \phpbb\controller\helper $this->config = $config; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; - $provider->set_ext_finder($manager->get_finder()); + $provider->find_routing_files($manager->get_finder()); $this->route_collection = $provider->find($phpbb_root_path_ext)->get_routes(); } } diff --git a/tests/pagination/pagination_test.php b/tests/pagination/pagination_test.php index 13b31779c0..f7a02dc419 100644 --- a/tests/pagination/pagination_test.php +++ b/tests/pagination/pagination_test.php @@ -40,7 +40,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case $this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1')); $provider = new \phpbb\controller\provider(); - $provider->set_ext_finder($this->finder); + $provider->find_routing_files($this->finder); $provider->find(dirname(__FILE__) . '/'); $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $provider, $manager, '', 'php', dirname(__FILE__) . '/'); $this->pagination = new \phpbb\pagination($this->template, $this->user, $this->helper);