From d8c1c7fb9aa2aa6d76c4e9769f1bb2c135909b23 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Sun, 16 Mar 2014 20:38:50 -0700 Subject: [PATCH] [ticket/7580] Add test for IF {VAR} is defined in templates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. {VAR} PHPBB3-7580 --- tests/template/template_test.php | 7 +++++++ tests/template/templates/if.html | 4 ++++ 2 files changed, 11 insertions(+) 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 @@ -90,6 +90,13 @@ class phpbb_template_template_test extends phpbb_template_template_test_case array(), '03!false', ), + array( + 'if.html', + array('VALUE_TEST' => 'value'), + array(), + array(), + '03!falsevalue', + ), array( 'loop.html', 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 !false + + +{VALUE_TEST} +