Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Test case for sqlparser.data.php (no function lines) #501

Merged
merged 5 commits into from

2 participants

@adamgsoc2013

No description provided.

@adamgsoc2013

Hi Michal,
the code in sqlparser.data.php are all global lines, it can't be covered by Code coverage.
so I add a function in source file and include it, thanks

@nijel nijel merged commit 0302d00 into from
@madhuracj madhuracj referenced this pull request from a commit
@madhuracj madhuracj rfe #501 Support for SSL GRANT option
Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
71ee861
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
18 libraries/sqlparser.lib.php
@@ -3018,4 +3018,22 @@ function PMA_SQP_isKeyWord($column)
return in_array(strtoupper($column), $PMA_SQPdata_forbidden_word);
}
+
+/**
+ * Get Parser Data Map from sqlparser.data.php
+ *
+ * @return Array Parser Data Map from sqlparser.data.php
+ */
+function PMA_SQP_getParserDataMap()
+{
+ include 'libraries/sqlparser.data.php';
+ return array(
+ 'PMA_SQPdata_function_name' => $PMA_SQPdata_function_name,
+ 'PMA_SQPdata_column_attrib' => $PMA_SQPdata_column_attrib,
+ 'PMA_SQPdata_reserved_word' => $PMA_SQPdata_reserved_word,
+ 'PMA_SQPdata_forbidden_word' => $PMA_SQPdata_forbidden_word,
+ 'PMA_SQPdata_column_type' => $PMA_SQPdata_column_type,
+ );
+}
+
?>
View
12 test/libraries/PMA_SQL_parser_data_test.php
@@ -10,6 +10,7 @@
* Include to test.
*/
require_once 'libraries/sqlparser.data.php';
+require_once 'libraries/sqlparser.lib.php';
class PMA_SQLParser_Data_Test extends PHPUnit_Framework_TestCase
{
@@ -26,6 +27,16 @@ private function _assertParserData($name)
$this->_assertSorted($GLOBALS[$name]);
}
+ public function testPMA_SQPdata()
+ {
+ $data = PMA_SQP_getParserDataMap();
+ $this->_assertSorted($data['PMA_SQPdata_function_name']);
+ $this->_assertSorted($data['PMA_SQPdata_column_attrib']);
+ $this->_assertSorted($data['PMA_SQPdata_reserved_word']);
+ $this->_assertSorted($data['PMA_SQPdata_forbidden_word']);
+ $this->_assertSorted($data['PMA_SQPdata_column_type']);
+ }
+
public function testPMA_SQPdata_function_name()
{
$this->_assertParserData('PMA_SQPdata_function_name');
@@ -52,4 +63,5 @@ public function testPMA_SQPdata_column_type()
}
}
+
?>
Something went wrong with that request. Please try again.