aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/config/services.yml2
-rw-r--r--phpBB/phpbb/controller/helper.php2
-rw-r--r--tests/controller/helper_route_test.php12
-rw-r--r--tests/pagination/pagination_test.php50
4 files changed, 36 insertions, 30 deletions
diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml
index e474c51ae0..2cf9dbed3e 100644
--- a/phpBB/config/services.yml
+++ b/phpBB/config/services.yml
@@ -109,6 +109,8 @@ services:
class: phpbb\controller\provider
arguments:
- @ext.finder
+ calls:
+ - [find, [%core.root_path%]]
cron.task_collection:
class: phpbb\di\service_collection
diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php
index 2d11a54c08..10fdbb1375 100644
--- a/phpBB/phpbb/controller/helper.php
+++ b/phpBB/phpbb/controller/helper.php
@@ -66,7 +66,7 @@ class helper
$this->config = $config;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
- $this->route_collection = $provider->find($this->phpbb_root_path)->get_routes();
+ $this->route_collection = $provider->get_routes();
}
/**
diff --git a/tests/controller/helper_route_test.php b/tests/controller/helper_route_test.php
index 21dbe2a87e..5264c788c7 100644
--- a/tests/controller/helper_route_test.php
+++ b/tests/controller/helper_route_test.php
@@ -28,7 +28,7 @@ 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->finder = new \phpbb\extension\finder(
+ $finder = new \phpbb\extension\finder(
new phpbb_mock_extension_manager(
dirname(__FILE__) . '/',
array(
@@ -43,6 +43,8 @@ class phpbb_controller_helper_route_test extends phpbb_test_case
dirname(__FILE__) . '/',
new phpbb_mock_cache()
);
+ $this->provider = new \phpbb\controller\provider($finder);
+ $this->provider->find(dirname(__FILE__) . '/');
}
public function helper_url_data_no_rewrite()
@@ -80,8 +82,8 @@ 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, new \phpbb\controller\provider($this->finder), dirname(__FILE__) . '/', 'php');
- $this->assertEquals(dirname(__FILE__) . '/' . $expected, $this->helper->route($route, $params, $is_amp, $session_id));
+ $this->helper = new \phpbb\controller\helper($this->template, $this->user, $this->config, $this->provider, '', 'php');
+ $this->assertEquals($expected, $this->helper->route($route, $params, $is_amp, $session_id));
}
public function helper_url_data_with_rewrite()
@@ -120,7 +122,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, new \phpbb\controller\provider($this->finder), dirname(__FILE__) . '/', 'php');
- $this->assertEquals(dirname(__FILE__) . '/' . $expected, $this->helper->route($route, $params, $is_amp, $session_id));
+ $this->helper = new \phpbb\controller\helper($this->template, $this->user, $this->config, $this->provider, '', '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 89be33ebab..71206dff58 100644
--- a/tests/pagination/pagination_test.php
+++ b/tests/pagination/pagination_test.php
@@ -38,7 +38,9 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
);
$this->config = new \phpbb\config\config(array('enable_mod_rewrite' => '1'));
- $this->helper = new \phpbb\controller\helper($this->template, $this->user, $this->config, new \phpbb\controller\provider($this->finder), dirname(__FILE__) . '/', 'php');
+ $provider = new \phpbb\controller\provider($this->finder);
+ $provider->find(dirname(__FILE__) . '/');
+ $this->helper = new \phpbb\controller\helper($this->template, $this->user, $this->config, $provider, '', 'php');
$this->pagination = new \phpbb\pagination($this->template, $this->user, $this->helper);
}
@@ -103,17 +105,17 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
:per_page:10
:current_page:2
:base_url:
- :previous::' . dirname(__FILE__) . '/' . 'test
- :else:1:' . dirname(__FILE__) . '/' . 'test
- :current:2:' . dirname(__FILE__) . '/' . 'test/page/2
- :else:3:' . dirname(__FILE__) . '/' . 'test/page/3
- :else:4:' . dirname(__FILE__) . '/' . 'test/page/4
- :else:5:' . dirname(__FILE__) . '/' . 'test/page/5
- :ellipsis:9:' . dirname(__FILE__) . '/' . 'test/page/9
- :else:10:' . dirname(__FILE__) . '/' . 'test/page/10
- :next::' . dirname(__FILE__) . '/' . 'test/page/3
- :u_prev:' . dirname(__FILE__) . '/' . 'test
- :u_next:' . dirname(__FILE__) . '/' . 'test/page/3',
+ :previous::test
+ :else:1:test
+ :current:2:test/page/2
+ :else:3:test/page/3
+ :else:4:test/page/4
+ :else:5:test/page/5
+ :ellipsis:9:test/page/9
+ :else:10:test/page/10
+ :next::test/page/3
+ :u_prev:test
+ :u_next:test/page/3',
),
array(
array('routes' => array(
@@ -128,18 +130,18 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
:per_page:10
:current_page:3
:base_url:
- :previous::' . dirname(__FILE__) . '/' . 'test/page/2
- :else:1:' . dirname(__FILE__) . '/' . 'test
- :else:2:' . dirname(__FILE__) . '/' . 'test/page/2
- :current:3:' . dirname(__FILE__) . '/' . 'test/page/3
- :else:4:' . dirname(__FILE__) . '/' . 'test/page/4
- :else:5:' . dirname(__FILE__) . '/' . 'test/page/5
- :else:6:' . dirname(__FILE__) . '/' . 'test/page/6
- :ellipsis:9:' . dirname(__FILE__) . '/' . 'test/page/9
- :else:10:' . dirname(__FILE__) . '/' . 'test/page/10
- :next::' . dirname(__FILE__) . '/' . 'test/page/4
- :u_prev:' . dirname(__FILE__) . '/' . 'test/page/2
- :u_next:' . dirname(__FILE__) . '/' . 'test/page/4',
+ :previous::test/page/2
+ :else:1:test
+ :else:2:test/page/2
+ :current:3:test/page/3
+ :else:4:test/page/4
+ :else:5:test/page/5
+ :else:6:test/page/6
+ :ellipsis:9:test/page/9
+ :else:10:test/page/10
+ :next::test/page/4
+ :u_prev:test/page/2
+ :u_next:test/page/4',
),
);
}