forked from phpmyadmin/phpmyadmin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPMA_SQL_parser_data_test.php
More file actions
68 lines (57 loc) · 1.43 KB
/
Copy pathPMA_SQL_parser_data_test.php
File metadata and controls
68 lines (57 loc) · 1.43 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* tests for correctness of SQL parser data
*
* @package phpMyAdmin-test
*/
/**
* Tests core.
*/
require_once 'PHPUnit/Framework.php';
define('PHPMYADMIN', 1);
/**
* Include to test.
*/
require_once './libraries/sqlparser.data.php';
/**
* Test for sorting of the arrays
*
* @package phpMyAdmin-test
*/
class PMA_SQL_parser_data_test extends PHPUnit_Framework_TestCase
{
private function assertSorted($array)
{
$copy = $array;
sort($copy);
$difference = array_diff_assoc($array, $copy);
$this->assertEquals($difference, array());
}
private function assertParserData($name)
{
$this->assertSorted($GLOBALS[$name]);
$this->assertEquals(count($GLOBALS[$name]), $GLOBALS[$name . '_cnt']);
}
public function testPMA_SQPdata_function_name()
{
$this->assertParserData('PMA_SQPdata_function_name');
}
public function testPMA_SQPdata_column_attrib()
{
$this->assertParserData('PMA_SQPdata_column_attrib');
}
public function testPMA_SQPdata_reserved_word()
{
$this->assertParserData('PMA_SQPdata_reserved_word');
}
public function testPMA_SQPdata_forbidden_word()
{
$this->assertParserData('PMA_SQPdata_forbidden_word');
}
public function testPMA_SQPdata_column_type()
{
$this->assertParserData('PMA_SQPdata_column_type');
}
}
?>