mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 14:00:31 +02:00
[develop-olympus] Backported 3.1 unit tests to 3.0.
Start adding unit tests for bugs you fix! Tests for anything are welcome really. We have to work on these a lot.
This commit is contained in:
3
tests/template/templates/_dummy_include.php
Normal file
3
tests/template/templates/_dummy_include.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
echo "testing included php";
|
20
tests/template/templates/basic.html
Normal file
20
tests/template/templates/basic.html
Normal file
@@ -0,0 +1,20 @@
|
||||
<!-- IF S_FALSE -->
|
||||
fail
|
||||
<!-- ENDIF -->
|
||||
<!-- IF S_TRUE -->
|
||||
pass
|
||||
<!-- ENDIF -->
|
||||
<!-- IF S_FALSE -->
|
||||
fail
|
||||
<!-- ELSEIF S_FALSE and not S_TRUE -->
|
||||
fail
|
||||
<!-- ELSE -->
|
||||
pass
|
||||
<!-- ENDIF -->
|
||||
<!-- BEGIN empty -->
|
||||
fail
|
||||
<!-- BEGINELSE -->
|
||||
pass
|
||||
<!-- END empty -->
|
||||
|
||||
<!-- DUMMY var -->
|
8
tests/template/templates/define.html
Normal file
8
tests/template/templates/define.html
Normal file
@@ -0,0 +1,8 @@
|
||||
<!-- DEFINE $VALUE = 'xyz' -->
|
||||
{$VALUE}
|
||||
<!-- DEFINE $VALUE = 'abc' -->
|
||||
{$VALUE}
|
||||
<!-- UNDEFINE $VALUE -->
|
||||
{$VALUE}
|
||||
<!-- DEFINE $VALUE -->
|
||||
|
86
tests/template/templates/expressions.html
Normal file
86
tests/template/templates/expressions.html
Normal file
@@ -0,0 +1,86 @@
|
||||
<!-- IF 10 is even -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
<!-- IF 9 is even -->fail<!-- ELSE -->pass<!-- ENDIF -->
|
||||
|
||||
<!-- IF not 390 is even -->fail<!-- ELSE -->pass<!-- ENDIF -->
|
||||
|
||||
<!-- IF 9 is odd -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
<!-- IF 32 is odd -->fail<!-- ELSE -->pass<!-- ENDIF -->
|
||||
|
||||
<!-- IF 32 is div by 16 -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
<!-- IF 10 is not even -->fail<!-- ELSE -->pass<!-- ENDIF -->
|
||||
|
||||
<!-- IF 24 == 24 -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
<!-- IF 24 eq 24 -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
<!-- IF ((((((24 == 24)))))) -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
|
||||
<!-- IF 24 != 20 -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
<!-- IF 24 <> 20 -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
<!-- IF 24 ne 20 -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
<!-- IF 24 neq 20 -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
|
||||
<!-- IF 10 lt 20 -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
<!-- IF 10 < 20 -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
|
||||
<!-- IF 10 le 20 -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
<!-- IF 10 lte 20 -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
<!-- IF 10 <= 20 -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
<!-- IF 20 le 20 -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
<!-- IF 20 lte 20 -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
<!-- IF 20 <= 20 -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
|
||||
<!-- IF 9 gt 1 -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
<!-- IF 9 > 1 -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
|
||||
<!-- IF 9 >= 1 -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
<!-- IF 9 gte 1 -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
<!-- IF 9 ge 1 -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
<!-- IF 9 >= 9 -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
<!-- IF 9 gte 9 -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
<!-- IF 9 ge 9 -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
|
||||
<!-- IF true && (10 > 4) -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
<!-- IF true and (10 > 4) -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
|
||||
<!-- IF false || true -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
<!-- IF false or true -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
|
||||
<!-- IF !false -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
<!-- IF not false -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
<!-- IF not not not false -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
|
||||
<!-- IF 6 % 4 == 2 -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
||||
|
||||
<!-- IF 24 mod 12 == 0 -->pass<!-- ELSE -->fail<!-- ENDIF -->
|
11
tests/template/templates/if.html
Normal file
11
tests/template/templates/if.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<!-- IF S_VALUE -->
|
||||
1
|
||||
<!-- ELSEIF S_OTHER_VALUE -->
|
||||
2
|
||||
<!-- ELSE -->
|
||||
0
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- IF (S_VALUE > S_OTHER_VALUE) -->
|
||||
0
|
||||
<!-- ENDIF -->
|
1
tests/template/templates/include.html
Normal file
1
tests/template/templates/include.html
Normal file
@@ -0,0 +1 @@
|
||||
<!-- INCLUDE variable.html -->
|
1
tests/template/templates/includephp.html
Normal file
1
tests/template/templates/includephp.html
Normal file
@@ -0,0 +1 @@
|
||||
<!-- INCLUDEPHP ../templates/_dummy_include.php -->
|
3
tests/template/templates/lang.html
Normal file
3
tests/template/templates/lang.html
Normal file
@@ -0,0 +1,3 @@
|
||||
{L_VARIABLE}
|
||||
|
||||
{LA_VARIABLE}
|
21
tests/template/templates/loop.html
Normal file
21
tests/template/templates/loop.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<!-- BEGIN loop -->
|
||||
loop
|
||||
<!-- BEGINELSE -->
|
||||
noloop
|
||||
<!-- END loop -->
|
||||
|
||||
<!-- IF .loop -->
|
||||
loop
|
||||
<!-- ELSE -->
|
||||
noloop
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- IF .loop == 2 -->
|
||||
loop
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- BEGIN loop -->
|
||||
<!-- BEGIN !block -->
|
||||
loop#{loop.S_ROW_COUNT}-block#{block.S_ROW_COUNT}
|
||||
<!-- END !block -->
|
||||
<!-- END loop -->
|
19
tests/template/templates/loop_advanced.html
Normal file
19
tests/template/templates/loop_advanced.html
Normal file
@@ -0,0 +1,19 @@
|
||||
<!-- BEGIN loop -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop -->
|
||||
x
|
||||
<!-- BEGIN loop(0) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop -->
|
||||
x
|
||||
<!-- BEGIN loop(0,-1) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop -->
|
||||
x
|
||||
<!-- BEGIN loop(1) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop -->
|
||||
x
|
||||
<!-- BEGIN loop(1,1) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop -->
|
||||
x
|
||||
<!-- BEGIN loop(0,1) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop -->
|
||||
x
|
||||
<!-- BEGIN loop(2,4) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop -->
|
||||
x
|
||||
<!-- BEGIN loop(0,-7) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop -->
|
||||
x
|
||||
<!-- BEGIN loop(-2,6) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop -->
|
||||
x
|
||||
<!-- BEGIN loop(-2,-1) -->{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW}<!-- END loop -->
|
8
tests/template/templates/loop_nested.html
Normal file
8
tests/template/templates/loop_nested.html
Normal file
@@ -0,0 +1,8 @@
|
||||
<!-- BEGIN outer -->
|
||||
{outer.S_BLOCK_NAME} - {outer.S_ROW_NUM}/{outer.S_NUM_ROWS}<!-- IF outer.VARIABLE --> - {outer.VARIABLE}<!-- ENDIF -->
|
||||
|
||||
<!-- BEGIN middle -->
|
||||
{middle.S_BLOCK_NAME} - {middle.S_ROW_NUM}/{middle.S_NUM_ROWS}<!-- IF middle.VARIABLE --> - {middle.VARIABLE}<!-- ENDIF -->
|
||||
|
||||
<!-- END middle -->
|
||||
<!-- END outer -->
|
21
tests/template/templates/loop_vars.html
Normal file
21
tests/template/templates/loop_vars.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<!-- BEGIN loop -->
|
||||
<!-- IF loop.S_FIRST_ROW -->first<!-- ENDIF -->
|
||||
|
||||
{loop.S_ROW_COUNT}
|
||||
|
||||
{loop.VARIABLE}
|
||||
|
||||
<!-- IF loop.VARIABLE -->set<!-- ENDIF -->
|
||||
|
||||
<!-- IF loop.S_LAST_ROW -->
|
||||
last
|
||||
<!-- ENDIF -->
|
||||
<!-- BEGIN inner -->
|
||||
|
||||
{inner.S_ROW_COUNT}
|
||||
|
||||
<!-- IF inner.S_LAST_ROW and inner.S_ROW_COUNT and inner.S_NUM_ROWS -->last inner<!-- ENDIF -->
|
||||
|
||||
<!-- END inner -->
|
||||
<!-- END loop -->
|
||||
<!-- IF .loop.inner -->inner loop<!-- ENDIF -->
|
1
tests/template/templates/php.html
Normal file
1
tests/template/templates/php.html
Normal file
@@ -0,0 +1 @@
|
||||
<!-- PHP -->echo "test";<!-- ENDPHP -->
|
1
tests/template/templates/variable.html
Normal file
1
tests/template/templates/variable.html
Normal file
@@ -0,0 +1 @@
|
||||
{VARIABLE}
|
Reference in New Issue
Block a user