aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorIgor Wiedler <igor@wiedler.ch>2011-09-21 18:12:07 +0200
committerIgor Wiedler <igor@wiedler.ch>2011-09-21 18:12:07 +0200
commite41f9c932970c81908f28735e0478510f6d1215b (patch)
tree35c9939fd5c1b24cb949580874eb181df249f97f /tests
parent47bb42e2f034cdb82e8f8e97b90639af9ed85b74 (diff)
parentfab0ec64b383c672e91db8524a225671795d4805 (diff)
downloadforums-e41f9c932970c81908f28735e0478510f6d1215b.tar
forums-e41f9c932970c81908f28735e0478510f6d1215b.tar.gz
forums-e41f9c932970c81908f28735e0478510f6d1215b.tar.bz2
forums-e41f9c932970c81908f28735e0478510f6d1215b.tar.xz
forums-e41f9c932970c81908f28735e0478510f6d1215b.zip
Merge branch 'develop' of github.com:phpbb/phpbb3 into develop
* 'develop' of github.com:phpbb/phpbb3: (44 commits) [ticket/10374] Remove 'custom template' cache prefix. [feature/remove-db-styles] Remove forgotten template variables. [feature/remove-db-styles] Removed style.php! [feature/remove-db-styles] Rework filesystem permission checks from 6d24a71. [feature/remove-db-styles] Update language to reflect removal of db storage. [feature/remove-db-styles] Mark log entrys as deprecated. [feature/remove-db-styles] Add error if template/theme file is unwritable. [feature/remove-db-styles] Add schema changes sinces 3.0.x. [feature/remove-db-styles] Readd table constant for upgrades etc. [feature/remove-db-styles] Update database schemas. [feature/remove-db-styles] Remove style.php DB storage. [feature/remove-db-styles] Remove parse_css_file option from themes. [feature/remove-db-styles] Remove DB theme handling code from session. [feature/remove-db-styles] ACP has forgotten how to store themes in the DB. [feature/remove-db-styles] Missed a few template DB bits in acp_styles. [feature/remove-db-styles] Removing unused methods from acp_style. [feature/remove-db-styles] Removed database storage of style components. [ticket/10371] Removing last mentions of imageset [ticket/10370] Add function documentation for get_stacktrace(). [ticket/10370] Explain that we are not the ones hiding backtrace pieces. ...
Diffstat (limited to 'tests')
-rw-r--r--tests/error_collector_test.php35
-rw-r--r--tests/template/template_test.php21
-rw-r--r--tests/template/templates/include_define.html2
-rw-r--r--tests/template/templates/include_loop.html4
-rw-r--r--tests/template/templates/include_loop1.html1
-rw-r--r--tests/template/templates/include_loop2.html1
-rw-r--r--tests/template/templates/include_loop3.html1
-rw-r--r--tests/template/templates/include_variable.html1
8 files changed, 66 insertions, 0 deletions
diff --git a/tests/error_collector_test.php b/tests/error_collector_test.php
new file mode 100644
index 0000000000..e1ac32f5ac
--- /dev/null
+++ b/tests/error_collector_test.php
@@ -0,0 +1,35 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2011 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+require_once dirname(__FILE__) . '/../phpBB/includes/functions.php';
+require_once dirname(__FILE__) . '/../phpBB/includes/error_collector.php';
+
+class phpbb_error_collector_test extends phpbb_test_case
+{
+ public function test_collection()
+ {
+ $collector = new phpbb_error_collector;
+ $collector->install();
+
+ // Cause a warning
+ 1/0; $line = __LINE__;
+
+ $collector->uninstall();
+
+ list($errno, $msg_text, $errfile, $errline) = $collector->errors[0];
+ $error_contents = $collector->format_errors();
+
+ $this->assertEquals($errno, 2);
+
+ // Unfortunately $error_contents will contain the full path here,
+ // because the tests directory is outside of phpbb root path.
+ $this->assertStringStartsWith('Errno 2: Division by zero at ', $error_contents);
+ $this->assertStringEndsWith(" line $line", $error_contents);
+ }
+}
diff --git a/tests/template/template_test.php b/tests/template/template_test.php
index 44baeaf8f0..28eba05217 100644
--- a/tests/template/template_test.php
+++ b/tests/template/template_test.php
@@ -163,6 +163,27 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
'value',
),
array(
+ 'include_define.html',
+ array('VARIABLE' => 'value'),
+ array(),
+ array(),
+ 'value',
+ ),
+ array(
+ 'include_loop.html',
+ array(),
+ array('loop' => array(array('NESTED_FILE' => 'include_loop1.html')), 'loop.inner' => array(array('NESTED_FILE' => 'include_loop1.html'), array('NESTED_FILE' => 'include_loop2.html'), array('NESTED_FILE' => 'include_loop3.html'))),
+ array(),
+ "1\n_1\n_02\n_3",
+ ),
+ array(
+ 'include_variable.html',
+ array('FILE' => 'variable.html', 'VARIABLE' => 'value'),
+ array(),
+ array(),
+ 'value',
+ ),
+ array(
'loop_vars.html',
array(),
array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'loop.inner' => array(array(), array())),
diff --git a/tests/template/templates/include_define.html b/tests/template/templates/include_define.html
new file mode 100644
index 0000000000..2419c8cba1
--- /dev/null
+++ b/tests/template/templates/include_define.html
@@ -0,0 +1,2 @@
+<!-- DEFINE $DEF = 'variable.html' -->
+<!-- INCLUDE {$DEF} -->
diff --git a/tests/template/templates/include_loop.html b/tests/template/templates/include_loop.html
new file mode 100644
index 0000000000..d5c3d9bc82
--- /dev/null
+++ b/tests/template/templates/include_loop.html
@@ -0,0 +1,4 @@
+<!-- BEGIN loop -->
+<!-- INCLUDE {loop.NESTED_FILE} -->
+<!-- BEGIN inner -->_<!-- INCLUDE {inner.NESTED_FILE} --><!-- END inner -->
+<!-- END loop -->
diff --git a/tests/template/templates/include_loop1.html b/tests/template/templates/include_loop1.html
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/tests/template/templates/include_loop1.html
@@ -0,0 +1 @@
+1
diff --git a/tests/template/templates/include_loop2.html b/tests/template/templates/include_loop2.html
new file mode 100644
index 0000000000..9e22bcb8e3
--- /dev/null
+++ b/tests/template/templates/include_loop2.html
@@ -0,0 +1 @@
+02
diff --git a/tests/template/templates/include_loop3.html b/tests/template/templates/include_loop3.html
new file mode 100644
index 0000000000..00750edc07
--- /dev/null
+++ b/tests/template/templates/include_loop3.html
@@ -0,0 +1 @@
+3
diff --git a/tests/template/templates/include_variable.html b/tests/template/templates/include_variable.html
new file mode 100644
index 0000000000..b907e0b44f
--- /dev/null
+++ b/tests/template/templates/include_variable.html
@@ -0,0 +1 @@
+<!-- INCLUDE {FILE} -->