mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/13538] Add tests for double nested pagination loop
PHPBB3-13538
This commit is contained in:
parent
ee03b4f1ef
commit
a5c65449de
2 changed files with 39 additions and 0 deletions
|
@ -188,6 +188,26 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
|
||||||
$this->assertEquals(str_replace("\t", '', $expect), $this->display('test'));
|
$this->assertEquals(str_replace("\t", '', $expect), $this->display('test'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider generate_template_pagination_data
|
||||||
|
*/
|
||||||
|
public function test_generate_template_pagination_double_nested($base_url, $start_name, $num_items, $per_page, $start_item, $expect)
|
||||||
|
{
|
||||||
|
// Block needs to be assigned before pagination
|
||||||
|
$this->template->assign_block_vars('sub', array(
|
||||||
|
'FOO' => 'bar',
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->template->assign_block_vars('sub.level2', array(
|
||||||
|
'BAR' => 'foo',
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->pagination->generate_template_pagination($base_url, 'sub.level2.pagination', $start_name, $num_items, $per_page, $start_item);
|
||||||
|
$this->template->set_filenames(array('test' => 'pagination_double_nested.html'));
|
||||||
|
|
||||||
|
$this->assertEquals(str_replace("\t", '', $expect), $this->display('test'));
|
||||||
|
}
|
||||||
|
|
||||||
public function on_page_data()
|
public function on_page_data()
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
|
|
19
tests/pagination/templates/pagination_double_nested.html
Normal file
19
tests/pagination/templates/pagination_double_nested.html
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
pagination
|
||||||
|
<!-- BEGIN sub -->
|
||||||
|
<!-- BEGIN level2 -->
|
||||||
|
:per_page:{sub.level2.PER_PAGE}
|
||||||
|
:current_page:{sub.level2.CURRENT_PAGE}
|
||||||
|
:base_url:{sub.level2.BASE_URL}
|
||||||
|
<!-- BEGIN pagination -->
|
||||||
|
<!-- IF sub.level2.pagination.S_IS_PREV -->:previous:{sub.level2.pagination.PAGE_NUMBER}:{sub.level2.pagination.PAGE_URL}
|
||||||
|
<!-- ELSEIF sub.level2.pagination.S_IS_CURRENT -->:current:{sub.level2.pagination.PAGE_NUMBER}:{sub.level2.pagination.PAGE_URL}
|
||||||
|
<!-- ELSEIF sub.level2.pagination.S_IS_ELLIPSIS -->:ellipsis:{sub.level2.pagination.PAGE_NUMBER}:{sub.level2.pagination.PAGE_URL}
|
||||||
|
<!-- ELSEIF sub.level2.pagination.S_IS_NEXT -->:next:{sub.level2.pagination.PAGE_NUMBER}:{sub.level2.pagination.PAGE_URL}
|
||||||
|
<!-- ELSE -->:else:{sub.level2.pagination.PAGE_NUMBER}:{sub.level2.pagination.PAGE_URL}
|
||||||
|
<!-- ENDIF -->
|
||||||
|
<!-- END pagination -->
|
||||||
|
<!-- IF sub.level2.U_PREVIOUS_PAGE -->:u_prev:{sub.level2.U_PREVIOUS_PAGE}<!-- ENDIF -->
|
||||||
|
|
||||||
|
<!-- IF sub.level2.U_NEXT_PAGE -->:u_next:{sub.level2.U_NEXT_PAGE}<!-- ENDIF -->
|
||||||
|
<!-- END level2 -->
|
||||||
|
<!-- END sub -->
|
Loading…
Add table
Reference in a new issue