No need to manually backup and restore globals; PHPUnit does it for us
This commit is contained in:
parent
50ecd45602
commit
28eeb7e3a7
@ -306,7 +306,6 @@ class Node_Test extends PHPUnit_Framework_TestCase
|
||||
// It would have been better to mock _getWhereClause method
|
||||
// but stangely, mocking private methods is not supported in PHPUnit
|
||||
$node = PMA_NodeFactory::getInstance();
|
||||
$origDbi = $GLOBALS['dbi'];
|
||||
|
||||
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
|
||||
->disableOriginalConstructor()
|
||||
@ -316,8 +315,6 @@ class Node_Test extends PHPUnit_Framework_TestCase
|
||||
->with($expectedSql);
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
$node->getData('', $pos);
|
||||
|
||||
$GLOBALS['dbi'] = $origDbi;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -346,7 +343,6 @@ class Node_Test extends PHPUnit_Framework_TestCase
|
||||
// It would have been better to mock _getWhereClause method
|
||||
// but stangely, mocking private methods is not supported in PHPUnit
|
||||
$node = PMA_NodeFactory::getInstance();
|
||||
$origDbi = $GLOBALS['dbi'];
|
||||
|
||||
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
|
||||
->disableOriginalConstructor()
|
||||
@ -356,8 +352,6 @@ class Node_Test extends PHPUnit_Framework_TestCase
|
||||
->with($query);
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
$node->getPresence();
|
||||
|
||||
$GLOBALS['dbi'] = $origDbi;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -380,7 +374,6 @@ class Node_Test extends PHPUnit_Framework_TestCase
|
||||
$GLOBALS['cfg']['Servers'][0]['DisableIS'] = true;
|
||||
|
||||
$node = PMA_NodeFactory::getInstance();
|
||||
$origDbi = $GLOBALS['dbi'];
|
||||
|
||||
// test with no search clause
|
||||
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
|
||||
@ -401,8 +394,6 @@ class Node_Test extends PHPUnit_Framework_TestCase
|
||||
->with("SHOW DATABASES LIKE '%dbname%' ");
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
$node->getPresence('', 'dbname');
|
||||
|
||||
$GLOBALS['dbi'] = $origDbi;
|
||||
}
|
||||
|
||||
public function testComment()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user