diff options
author | Matt Friedman <maf675@gmail.com> | 2014-03-16 20:38:50 -0700 |
---|---|---|
committer | Matt Friedman <maf675@gmail.com> | 2014-03-16 20:38:50 -0700 |
commit | d8c1c7fb9aa2aa6d76c4e9769f1bb2c135909b23 (patch) | |
tree | fd549894f2f6680974380a57b96b958624540eaf | |
parent | f9438bcbf700b9d237791390c0ec6aca461e8fd7 (diff) | |
download | forums-d8c1c7fb9aa2aa6d76c4e9769f1bb2c135909b23.tar forums-d8c1c7fb9aa2aa6d76c4e9769f1bb2c135909b23.tar.gz forums-d8c1c7fb9aa2aa6d76c4e9769f1bb2c135909b23.tar.bz2 forums-d8c1c7fb9aa2aa6d76c4e9769f1bb2c135909b23.tar.xz forums-d8c1c7fb9aa2aa6d76c4e9769f1bb2c135909b23.zip |
[ticket/7580] Add test for IF {VAR} is defined in templates
http://tracker.phpbb.com/browse/PHPBB3-7580
This test demonstrates that is possible to test if a
variable exists and then use it if it does, similar to
using isset(), but in template/twig syntax.
<!— IF {VAR} is defined —>{VAR}<!— ENDIF —>
PHPBB3-7580
-rw-r--r-- | tests/template/template_test.php | 7 | ||||
-rw-r--r-- | tests/template/templates/if.html | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 2b7be9746e..74baa3d5b6 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -91,6 +91,13 @@ class phpbb_template_template_test extends phpbb_template_template_test_case '03!false', ), array( + 'if.html', + array('VALUE_TEST' => 'value'), + array(), + array(), + '03!falsevalue', + ), + array( 'loop.html', array(), array(), diff --git a/tests/template/templates/if.html b/tests/template/templates/if.html index f6ab6e575a..71312f994c 100644 --- a/tests/template/templates/if.html +++ b/tests/template/templates/if.html @@ -19,3 +19,7 @@ false <!-- IF S_TEST !== false --> !false <!-- ENDIF --> + +<!-- IF VALUE_TEST is defined --> +{VALUE_TEST} +<!-- ENDIF --> |