Skip to content

Commit

Permalink
Update test/libraries/common/PMA_quoting_slashing_test.php
Browse files Browse the repository at this point in the history
Added test for PMA_CommonFunctions::getInstance()->backquote_compat function.
  • Loading branch information
hastenax committed Aug 2, 2012
1 parent 93d8688 commit b062ebd
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/libraries/common/PMA_quoting_slashing_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,41 @@ public function testBackquote($a, $b)
$this->assertEquals($b, PMA_CommonFunctions::getInstance()->backquote($a));
}

/**
* data provider for backquote_compat test
*
* @return array
*/
public function backquote_compatDataProvider()
{
return array(
array('0', '"0"'),
array('test', '"test"'),
array('te`st', '"te`st"'),
array(array('test', 'te`st', '', '*'), array('"test"', '"te`st"', '', '*'))
);
}

/**
* backquote_compat test with different param $compatibility (NONE, MSSQL)
* @dataProvider backquote_compatDataProvider
*/
public function testBackquote_compat($a, $b)
{
// Test bypass quoting (used by dump functions)
$this->assertEquals($a, PMA_CommonFunctions::getInstance()->backquote_compat($a, 'NONE', false));

// Test backquote (backquoting will be enabled only if isset $GLOBALS['sql_backquotes']
$this->assertEquals($a, PMA_CommonFunctions::getInstance()->backquote_compat($a, 'NONE'));

// Run tests in MSSQL compatibility mode
// Test bypass quoting (used by dump functions)
$this->assertEquals($a, PMA_CommonFunctions::getInstance()->backquote_compat($a, 'MSSQL', false));

// Test backquote
$this->assertEquals($b, PMA_CommonFunctions::getInstance()->backquote_compat($a, 'MSSQL'));
}

public function testBackquoteForbidenWords()
{
global $PMA_SQPdata_forbidden_word;
Expand Down

0 comments on commit b062ebd

Please sign in to comment.