aboutsummaryrefslogtreecommitdiffstats
path: root/tests/pagination
diff options
context:
space:
mode:
Diffstat (limited to 'tests/pagination')
-rw-r--r--tests/pagination/config/routing.yml6
-rw-r--r--tests/pagination/pagination_test.php40
2 files changed, 37 insertions, 9 deletions
diff --git a/tests/pagination/config/routing.yml b/tests/pagination/config/routing.yml
new file mode 100644
index 0000000000..dd667274cd
--- /dev/null
+++ b/tests/pagination/config/routing.yml
@@ -0,0 +1,6 @@
+core_controller:
+ pattern: /test
+ defaults: { _controller: core_foo.controller:bar, page: 1}
+core_page_controller:
+ pattern: /test/page/{page}
+ defaults: { _controller: core_foo.controller:bar}
diff --git a/tests/pagination/pagination_test.php b/tests/pagination/pagination_test.php
index b7a4f101aa..71206dff58 100644
--- a/tests/pagination/pagination_test.php
+++ b/tests/pagination/pagination_test.php
@@ -21,11 +21,27 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
public function setUp()
{
parent::setUp();
- $user = $this->getMock('\phpbb\user');
- $user->expects($this->any())
+
+ global $phpbb_dispatcher;
+
+ $phpbb_dispatcher = new phpbb_mock_event_dispatcher;
+ $this->user = $this->getMock('\phpbb\user');
+ $this->user->expects($this->any())
->method('lang')
->will($this->returnCallback(array($this, 'return_callback_implode')));
- $this->pagination = new \phpbb\pagination($this->template, $user);
+
+ $this->finder = new \phpbb\extension\finder(
+ new phpbb_mock_extension_manager(dirname(__FILE__) . '/', array()),
+ 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->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);
}
public function generate_template_pagination_data()
@@ -77,15 +93,18 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
:u_next:page.php?start=30',
),
array(
- 'test/page/%d',
- '/page/%d',
+ array('routes' => array(
+ 'core_controller',
+ 'core_page_controller',
+ )),
+ 'page',
95,
10,
10,
'pagination
:per_page:10
:current_page:2
- :base_url:test/page/%d
+ :base_url:
:previous::test
:else:1:test
:current:2:test/page/2
@@ -99,15 +118,18 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
:u_next:test/page/3',
),
array(
- 'test/page/%d',
- '/page/%d',
+ array('routes' => array(
+ 'core_controller',
+ 'core_page_controller',
+ )),
+ 'page',
95,
10,
20,
'pagination
:per_page:10
:current_page:3
- :base_url:test/page/%d
+ :base_url:
:previous::test/page/2
:else:1:test
:else:2:test/page/2