aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2011-11-14 15:46:50 +0100
committerAndreas Fischer <bantu@phpbb.com>2011-11-14 15:46:50 +0100
commitf31da015fcad1efb792e78462af7eb56e1abcabc (patch)
treeb1f981fd095f751eec3b7f0c64164de43e6490de /tests
parent9d7b144c54f28faf02f93740930dfb633c2e78cb (diff)
parent3302305cd4a499603784aa87a40f5170d62a4f26 (diff)
downloadforums-f31da015fcad1efb792e78462af7eb56e1abcabc.tar
forums-f31da015fcad1efb792e78462af7eb56e1abcabc.tar.gz
forums-f31da015fcad1efb792e78462af7eb56e1abcabc.tar.bz2
forums-f31da015fcad1efb792e78462af7eb56e1abcabc.tar.xz
forums-f31da015fcad1efb792e78462af7eb56e1abcabc.zip
Merge remote-tracking branch 'nickvergessen/ticket/9066' into develop-olympus
* nickvergessen/ticket/9066: [ticket/9066] Move regex into get_preg_expression function and add tests [ticket/9066] Disallow some database prefix to prevent same errors and problems
Diffstat (limited to 'tests')
-rw-r--r--tests/regex/table_prefix_test.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/regex/table_prefix_test.php b/tests/regex/table_prefix_test.php
new file mode 100644
index 0000000000..67a18b4fbc
--- /dev/null
+++ b/tests/regex/table_prefix_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';
+
+class phpbb_regex_table_prefix_test extends phpbb_test_case
+{
+ public function table_prefix_test_data()
+ {
+ return array(
+ array('phpbb_', 1),
+ array('phpBB3', 1),
+ array('a', 1),
+
+ array('', 0),
+ array('_', 0),
+ array('a-', 0),
+ array("'", 0),
+ );
+ }
+
+ /**
+ * @dataProvider table_prefix_test_data
+ */
+ public function test_table_prefix($prefix, $expected)
+ {
+ $this->assertEquals($expected, preg_match(get_preg_expression('table_prefix'), $prefix));
+ }
+}