diff --git a/tests/template/template_includecss_test.php b/tests/template/template_includecss_test.php index f77740da50..b503dbc45d 100644 --- a/tests/template/template_includecss_test.php +++ b/tests/template/template_includecss_test.php @@ -123,4 +123,18 @@ class phpbb_template_template_includecss_test extends phpbb_template_template_te // Run test $this->run_template('includecss.html', array(), array(), array(), $expected); } + + /** + * @dataProvider template_data + */ + public function test_include_css_compilation($vars, $expected) + { + // Reset the engine state + $this->setup_engine(array('assets_version' => 1)); + + $this->template->assign_vars($vars); + + // Run test + $this->run_template('includecss_twig.html', array(), array(), array(), $expected); + } } diff --git a/tests/template/template_includejs_test.php b/tests/template/template_includejs_test.php index 7580d4b32d..9886ced6ad 100644 --- a/tests/template/template_includejs_test.php +++ b/tests/template/template_includejs_test.php @@ -106,4 +106,18 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes // Run test $this->run_template('includejs.html', array_merge(array('PARENT' => 'parent_only.js', 'SUBDIR' => 'subdir', 'EXT' => 'js'), $vars), array(), array(), $expected); } + + /** + * @dataProvider template_data + */ + public function test_include_js_compilation($vars, $expected) + { + // Reset the engine state + $this->setup_engine(array('assets_version' => 1)); + + $this->template->assign_vars($vars); + + // Run test + $this->run_template('includejs_twig.html', array_merge(array('PARENT' => 'parent_only.js', 'SUBDIR' => 'subdir', 'EXT' => 'js'), $vars), array(), array(), $expected); + } } diff --git a/tests/template/templates/includecss_twig.html b/tests/template/templates/includecss_twig.html new file mode 100644 index 0000000000..935633d573 --- /dev/null +++ b/tests/template/templates/includecss_twig.html @@ -0,0 +1,10 @@ +{% if TEST === 1 %} + {% INCLUDECSS('child_only.css') %} +{% elseif TEST === 2 %} + {% INCLUDECSS('parent_only.css') %} +{% elseif TEST === 3 %} + {% INCLUDECSS('@include_css/test.css') %} +{% elseif TEST === 4 %} + {% INCLUDECSS('@include_css/child_only.css') %} +{% endif %} +{$STYLESHEETS} diff --git a/tests/template/templates/includejs_twig.html b/tests/template/templates/includejs_twig.html new file mode 100644 index 0000000000..dcf29bf0d1 --- /dev/null +++ b/tests/template/templates/includejs_twig.html @@ -0,0 +1,36 @@ +{% if TEST === 1 %} + {% INCLUDEJS('parent_and_child.js') %} +{% elseif TEST === 2 %} + {% INCLUDEJS('parent_and_child.js?assets_version=0') %} +{% elseif TEST === 3 %} + {% INCLUDEJS('parent_and_child.js?test=1&assets_version=0') %} +{% elseif TEST === 4 %} + {% INCLUDEJS('parent_and_child.js?test=1&assets_version=0') %} +{% elseif TEST === 6 %} + {% INCLUDEJS(PARENT) %} +{% elseif TEST === 7 %} + {% set test_var = 'child_only.js' %} + {% INCLUDEJS(test_var) %} +{% elseif TEST === 8 %} + {% INCLUDEJS('subdir/' ~ PARENT) %} +{% elseif TEST === 9 %} + {% INCLUDEJS(SUBDIR ~ '/subsubdir/' ~ PARENT) %} +{% elseif TEST === 10 %} + {% INCLUDEJS(SUBDIR ~ '/parent_only.' ~ EXT) %} +{% elseif TEST === 11 %} + {% set test_var = 'child_only.js?test1=1&test2=2#test3' %} + {% INCLUDEJS(test_var) %} +{% elseif TEST === 12 %} + {% INCLUDEJS('parent_only.js?test1=1&test2=2#test3') %} +{% elseif TEST === 14 %} + {% INCLUDEJS('parent_only.js?test1="#test3') %} +{% elseif TEST === 15 %} + {% INCLUDEJS('http://phpbb.com/b.js?c=d#f') %} +{% elseif TEST === 16 %} + {% INCLUDEJS('http://phpbb.com/b.js?c=d&assets_version=2#f') %} +{% elseif TEST === 17 %} + {% INCLUDEJS('//phpbb.com/b.js') %} +{% elseif TEST === 18 %} + {% INCLUDEJS('parent_and_child.js?test=1&test2=0') %} +{% endif %} +{$SCRIPTS}