Fix tests regarding Advisor class changes
Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>
This commit is contained in:
parent
99b2dfade4
commit
efbec55643
@ -23,6 +23,9 @@ use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
|
||||
*/
|
||||
class Advisor
|
||||
{
|
||||
const GENERIC_RULES_FILE = 'libraries/advisory_rules_generic.txt';
|
||||
const BEFORE_MYSQL80003_RULES_FILE = 'libraries/advisory_rules_mysql_before80003.txt';
|
||||
|
||||
protected $dbi;
|
||||
protected $variables;
|
||||
protected $globals;
|
||||
@ -444,10 +447,10 @@ class Advisor
|
||||
protected function defineRulesFiles()
|
||||
{
|
||||
$isMariaDB = false !== strpos($this->getVariables()['version'], 'MariaDB');
|
||||
$ruleFiles = ['libraries/advisory_rules_generic.txt'];
|
||||
$ruleFiles = [self::GENERIC_RULES_FILE];
|
||||
// If MariaDB (= not MySQL) OR MYSQL < 8.0.3, add another rules file.
|
||||
if ($isMariaDB || $this->globals['PMA_MYSQL_INT_VERSION'] < 80003) {
|
||||
$ruleFiles[] = 'libraries/advisory_rules_mysql_before80003.txt';
|
||||
$ruleFiles[] = self::BEFORE_MYSQL80003_RULES_FILE;
|
||||
}
|
||||
return $ruleFiles;
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ class AdvisorTest extends PmaTestCase
|
||||
public function testParse()
|
||||
{
|
||||
$advisor = new Advisor($GLOBALS['dbi'], new ExpressionLanguage());
|
||||
$parseResult = $advisor->parseRulesFile();
|
||||
$parseResult = $advisor->parseRulesFile(Advisor::GENERIC_RULES_FILE);
|
||||
$this->assertEquals($parseResult['errors'], array());
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ class AdvisorTest extends PmaTestCase
|
||||
public function testAddRule($rule, $expected, $error)
|
||||
{
|
||||
$advisor = new Advisor($GLOBALS['dbi'], new ExpressionLanguage());
|
||||
$parseResult = $advisor->parseRulesFile();
|
||||
$parseResult = $advisor->parseRulesFile(Advisor::GENERIC_RULES_FILE);
|
||||
$this->assertEquals($parseResult['errors'], array());
|
||||
$advisor->setVariable('value', 0);
|
||||
$advisor->addRule('fired', $rule);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user