1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

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
This commit is contained in:
Andreas Fischer
2011-11-14 15:46:50 +01:00
4 changed files with 47 additions and 1 deletions

View File

@@ -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));
}
}