Skip to content

Commit

Permalink
Make parser test work with error reporting as well
Browse files Browse the repository at this point in the history
  • Loading branch information
nijel committed Jun 11, 2013
1 parent 83712de commit 158389e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions test/libraries/PMA_SQL_parser_test.php
Expand Up @@ -10,6 +10,11 @@
* Include to test.
*/
require_once 'libraries/sqlparser.lib.php';
require_once 'libraries/php-gettext/gettext.inc';
require_once 'libraries/Message.class.php';
require_once 'libraries/Util.class.php';
require_once 'libraries/Theme.class.php';
require_once 'libraries/sanitizing.lib.php';

class PMA_SQLParser_Test extends PHPUnit_Framework_TestCase
{
Expand All @@ -23,6 +28,8 @@ public function setUp()
if (function_exists('mb_internal_encoding')) {
mb_internal_encoding('utf-8');
}
$_SESSION['PMA_Theme'] = new PMA_Theme();
$GLOBALS['pmaThemeImage'] = 'theme/';
}

/**
Expand All @@ -40,8 +47,9 @@ public function setUp()
public function testParser($sql, $expected, $error = '')
{
PMA_SQP_resetError();
$this->expectOutputString($error);
$parsed_sql = PMA_SQP_parse($sql);
$this->assertEquals($error, PMA_SQP_getErrorString());
$this->assertEquals('', PMA_SQP_getErrorString());
$this->assertEquals($expected, $parsed_sql);
}

Expand Down Expand Up @@ -177,7 +185,8 @@ public function parserData()
'pos' => 0,
),
'len' => 5,
)
),
'<div class="notice"><img src="theme/s_notice.png" title="" alt="" /> Automatically appended backtick to the end of query!</div>'
),
array(
'SELECT * FROM `a_table` tbla INNER JOIN b_table` tblb ON tblb.id = tbla.id WHERE tblb.field1 != tbla.field1`;',
Expand Down

0 comments on commit 158389e

Please sign in to comment.