mirror of
https://github.com/phpbb/phpbb.git
synced 2025-01-17 22:28:46 +01:00
Merge pull request #6303 from marc1706/ticket/13508
[ticket/13508] Add tests for INCLUDEJS & INCLUDECSS with twig syntax
This commit is contained in:
commit
62a8741494
@ -125,4 +125,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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
10
tests/template/templates/includecss_twig.html
Normal file
10
tests/template/templates/includecss_twig.html
Normal file
@ -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}
|
36
tests/template/templates/includejs_twig.html
Normal file
36
tests/template/templates/includejs_twig.html
Normal file
@ -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}
|
Loading…
x
Reference in New Issue
Block a user