aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorIgor Wiedler <igor@wiedler.ch>2011-04-26 02:09:51 +0200
committerOleg Pudeyev <oleg@bsdpower.com>2011-04-25 23:19:36 -0400
commit427a5122d55f06c861277297411f7e39a03a703c (patch)
tree3abfb707f699113204d7c7a7d4ca04b24e70c65b /tests
parentf0b97cfdcf851eec4660412e4c061a26b921c740 (diff)
downloadforums-427a5122d55f06c861277297411f7e39a03a703c.tar
forums-427a5122d55f06c861277297411f7e39a03a703c.tar.gz
forums-427a5122d55f06c861277297411f7e39a03a703c.tar.bz2
forums-427a5122d55f06c861277297411f7e39a03a703c.tar.xz
forums-427a5122d55f06c861277297411f7e39a03a703c.zip
[feature/template-engine] Fix negative variable expressions
compile_tag_if had the flawed approach of adding an isset statement for all variables to the beginning of the if. This fails for negative expressions, and checking those takes a considerable effort. The easier solution is to make the variable expression itself conditional, defaulting to null if it is not set. Thanks to naderman for the solution. PHPBB3-9726
Diffstat (limited to 'tests')
-rw-r--r--tests/template/template_test.php2
-rw-r--r--tests/template/templates/basic.html3
-rw-r--r--tests/template/templates/if.html2
3 files changed, 5 insertions, 2 deletions
diff --git a/tests/template/template_test.php b/tests/template/template_test.php
index 4304035192..0a46ff4d23 100644
--- a/tests/template/template_test.php
+++ b/tests/template/template_test.php
@@ -91,7 +91,7 @@ class phpbb_template_template_test extends phpbb_test_case
array(),
array(),
array(),
- "pass\npass\n<!-- DUMMY var -->",
+ "pass\npass\npass\n<!-- DUMMY var -->",
),
array(
'variable.html',
diff --git a/tests/template/templates/basic.html b/tests/template/templates/basic.html
index c1dd690260..e5c6f280fb 100644
--- a/tests/template/templates/basic.html
+++ b/tests/template/templates/basic.html
@@ -16,5 +16,8 @@ fail
<!-- BEGINELSE -->
pass
<!-- END empty -->
+<!-- IF not S_EMPTY -->
+pass
+<!-- ENDIF -->
<!-- DUMMY var -->
diff --git a/tests/template/templates/if.html b/tests/template/templates/if.html
index 41ff024779..eed431019e 100644
--- a/tests/template/templates/if.html
+++ b/tests/template/templates/if.html
@@ -6,6 +6,6 @@
03
<!-- ENDIF -->
-<!-- IF (S_VALUE > S_OTHER_VALUE) -->
+<!-- IF S_VALUE and S_OTHER_VALUE and (S_VALUE > S_OTHER_VALUE) -->
04
<!-- ENDIF -->