From 09804bbae80c36989aba6631afca0dbdd3781f75 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 10 Apr 2014 16:06:00 +0200 Subject: [PATCH 1/3] [ticket/12382] Add template test for subloops inside events PHPBB3-12382 --- .../all/template/event/test_event_subloop.html | 2 ++ .../styles/silver/template/event_subloop.html | 3 +++ tests/template/template_events_test.php | 13 +++++++++++++ 3 files changed, 18 insertions(+) create mode 100644 tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/test_event_subloop.html create mode 100644 tests/template/datasets/ext_trivial/styles/silver/template/event_subloop.html diff --git a/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/test_event_subloop.html b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/test_event_subloop.html new file mode 100644 index 0000000000..4fdba859f3 --- /dev/null +++ b/tests/template/datasets/ext_trivial/ext/trivial/styles/all/template/event/test_event_subloop.html @@ -0,0 +1,2 @@ +[{event_loop.S_ROW_COUNT}[subloop:{event_loop.subloop.S_ROW_COUNT}] +] diff --git a/tests/template/datasets/ext_trivial/styles/silver/template/event_subloop.html b/tests/template/datasets/ext_trivial/styles/silver/template/event_subloop.html new file mode 100644 index 0000000000..233b32a4c7 --- /dev/null +++ b/tests/template/datasets/ext_trivial/styles/silver/template/event_subloop.html @@ -0,0 +1,3 @@ + +event_loop + diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php index 41e00e86a7..4416dc4b2c 100644 --- a/tests/template/template_events_test.php +++ b/tests/template/template_events_test.php @@ -90,6 +90,19 @@ Zeta test event in all', array(), 'event_loop0|event_loop1|event_loop2', ), + array( + 'EVENT with subloop in loop', + 'ext_trivial', + array('silver'), + 'event_subloop.html', + array(), + array( + 'event_loop' => array(array()), + 'event_loop.subloop' => array(array()), + ), + array(), + 'event_loop[0[subloop:0]]', + ), ); } From b3a758a43b3b8ef9dbb3b0a66b9c708639cdd6d9 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 12 Apr 2014 11:11:28 +0200 Subject: [PATCH 2/3] [ticket/12382] Add template test for subloops inside includes PHPBB3-12382 --- tests/template/template_test.php | 10 ++++++++++ tests/template/templates/loop_nested_include.html | 4 ++++ tests/template/templates/loop_nested_include1.html | 5 +++++ 3 files changed, 19 insertions(+) create mode 100644 tests/template/templates/loop_nested_include.html create mode 100644 tests/template/templates/loop_nested_include1.html diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 74baa3d5b6..c012f6c855 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -320,6 +320,16 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array(), "barbarbar1bar1", ), + array( + 'loop_nested_include.html', + array(), + array( + 'test_loop' => array(array('foo' => 'bar'), array('foo' => 'bar1')), + 'test_loop.inner' => array(array('myinner' => 'works')), + ), + array(), + "[bar|[bar|]][bar1|[bar1|[bar1|works]]]", + ), /* Does not pass with the current implementation. array( 'loop_reuse.html', diff --git a/tests/template/templates/loop_nested_include.html b/tests/template/templates/loop_nested_include.html new file mode 100644 index 0000000000..eaad46cc5b --- /dev/null +++ b/tests/template/templates/loop_nested_include.html @@ -0,0 +1,4 @@ + +[{test_loop.foo} + |] + diff --git a/tests/template/templates/loop_nested_include1.html b/tests/template/templates/loop_nested_include1.html new file mode 100644 index 0000000000..0f1a180b4d --- /dev/null +++ b/tests/template/templates/loop_nested_include1.html @@ -0,0 +1,5 @@ +[{test_loop.foo}| + +[{test_loop.foo}| +{test_loop.inner.myinner}] +] From 91eaae122f2671d14b5f83481c883daeaffed693 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 14 Apr 2014 18:56:34 +0200 Subject: [PATCH 3/3] [ticket/12382] Mark broken nested loop with include as incomplete PHPBB3-12382 --- tests/template/template_events_test.php | 8 +++++++- tests/template/template_test.php | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php index 4416dc4b2c..d09f22944f 100644 --- a/tests/template/template_events_test.php +++ b/tests/template/template_events_test.php @@ -102,6 +102,7 @@ Zeta test event in all', ), array(), 'event_loop[0[subloop:0]]', + 'Event files are missing opened parent loops: PHPBB3-12382', ), ); } @@ -109,8 +110,13 @@ Zeta test event in all', /** * @dataProvider template_data */ - public function test_event($desc, $dataset, $style_names, $file, array $vars, array $block_vars, array $destroy, $expected) + public function test_event($desc, $dataset, $style_names, $file, array $vars, array $block_vars, array $destroy, $expected, $incomplete_message = '') { + if ($incomplete_message) + { + $this->markTestIncomplete($incomplete_message); + } + // Reset the engine state $this->setup_engine_for_events($dataset, $style_names); diff --git a/tests/template/template_test.php b/tests/template/template_test.php index c012f6c855..49804c26c5 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -329,6 +329,8 @@ class phpbb_template_template_test extends phpbb_template_template_test_case ), array(), "[bar|[bar|]][bar1|[bar1|[bar1|works]]]", + array(), + 'Included files are missing opened parent loops: PHPBB3-12382', ), /* Does not pass with the current implementation. array( @@ -373,8 +375,13 @@ class phpbb_template_template_test extends phpbb_template_template_test_case /** * @dataProvider template_data */ - public function test_template($file, array $vars, array $block_vars, array $destroy, $expected, $lang_vars = array()) + public function test_template($file, array $vars, array $block_vars, array $destroy, $expected, $lang_vars = array(), $incomplete_message = '') { + if ($incomplete_message) + { + $this->markTestIncomplete($incomplete_message); + } + $this->run_template($file, $vars, $block_vars, $destroy, $expected, $lang_vars); }