aboutsummaryrefslogtreecommitdiffstats
path: root/tests/regex/table_prefix_test.php
blob: c593085b255bdf0890b73f1ed0b898757a24984f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/

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