1
0
mirror of https://github.com/phpmyadmin/phpmyadmin.git synced 2026-10-31 10:54:46 +03:00

Fixed tests in Central Columns

Signed-off-by: Deven Bansod <devenbansod.bits@gmail.com>
This commit is contained in:
Deven Bansod
2016-11-04 15:12:28 +05:30
parent 46d3f940d7
commit fe71fbda56

View File

@@ -132,6 +132,8 @@ class PMA_Central_Columns_Test extends PHPUnit_Framework_TestCase
->will(
$this->returnValue(array("PMA_table", "PMA_table1", "PMA_table2"))
);
$dbi->expects($this->any())->method('escapeString')
->will($this->returnArgument(0));
}
@@ -159,28 +161,11 @@ class PMA_Central_Columns_Test extends PHPUnit_Framework_TestCase
*/
public function testPMAGetColumnsList()
{
$GLOBALS['dbi']->expects($this->at(1))
$GLOBALS['dbi']->expects($this->exactly(2))
->method('fetchResult')
->with(
"SELECT * FROM `pma_central_columns` "
. "WHERE db_name = 'phpmyadmin' LIMIT 0, 25;",
null, null, $GLOBALS['controllink']
)
->will(
$this->returnValue($this->_columnData)
);
$GLOBALS['dbi']->expects($this->at(3))
->method('fetchResult')
->with(
"SELECT * FROM `pma_central_columns` "
. "WHERE db_name = 'phpmyadmin' LIMIT 1, 2;",
null, null, $GLOBALS['controllink']
)
->will(
$this->returnValue(
array_slice($this->_columnData, 1, 2)
)
->willReturnOnConsecutiveCalls(
$this->_columnData,
array_slice($this->_columnData, 1, 2)
);
$this->assertEquals(
@@ -200,7 +185,7 @@ class PMA_Central_Columns_Test extends PHPUnit_Framework_TestCase
*/
function testPMAGetCentralColumnsCount()
{
$GLOBALS['dbi']->expects($this->at(1))
$GLOBALS['dbi']->expects($this->once())
->method('fetchResult')
->with(
"SELECT count(db_name) FROM `pma_central_columns` "
@@ -243,7 +228,7 @@ class PMA_Central_Columns_Test extends PHPUnit_Framework_TestCase
$_REQUEST['table'] = 'PMA_table';
// when column exists in the central column list
$GLOBALS['dbi']->expects($this->at(2))
$GLOBALS['dbi']->expects($this->at(4))
->method('fetchResult')
->with(
"SELECT col_name FROM `pma_central_columns` "
@@ -254,7 +239,7 @@ class PMA_Central_Columns_Test extends PHPUnit_Framework_TestCase
$this->returnValue(array('col1'))
);
$GLOBALS['dbi']->expects($this->at(4))
$GLOBALS['dbi']->expects($this->at(7))
->method('tryQuery')
->with(
"DELETE FROM `pma_central_columns` "
@@ -311,7 +296,7 @@ class PMA_Central_Columns_Test extends PHPUnit_Framework_TestCase
$db = 'PMA_db';
$table = 'PMA_table';
$GLOBALS['dbi']->expects($this->at(3))
$GLOBALS['dbi']->expects($this->once())
->method('fetchResult')
->with(
"SELECT col_name FROM `pma_central_columns` "
@@ -337,7 +322,7 @@ class PMA_Central_Columns_Test extends PHPUnit_Framework_TestCase
$db = 'PMA_db';
$table = 'PMA_table';
$GLOBALS['dbi']->expects($this->at(3))
$GLOBALS['dbi']->expects($this->once())
->method('fetchResult')
->with(
"SELECT * FROM `pma_central_columns` "
@@ -505,7 +490,7 @@ class PMA_Central_Columns_Test extends PHPUnit_Framework_TestCase
*/
public function testPMAGetCentralColumnsListRaw()
{
$GLOBALS['dbi']->expects($this->at(1))
$GLOBALS['dbi']->expects($this->once())
->method('fetchResult')
->with(
"SELECT * FROM `pma_central_columns` "
@@ -528,7 +513,7 @@ class PMA_Central_Columns_Test extends PHPUnit_Framework_TestCase
*/
public function testPMAGetCentralColumnsListRawWithTable()
{
$GLOBALS['dbi']->expects($this->at(3))
$GLOBALS['dbi']->expects($this->once())
->method('fetchResult')
->with(
"SELECT * FROM `pma_central_columns` "
@@ -592,7 +577,7 @@ class PMA_Central_Columns_Test extends PHPUnit_Framework_TestCase
*/
public function testPMAFindExistingColNames()
{
$GLOBALS['dbi']->expects($this->at(1))
$GLOBALS['dbi']->expects($this->once())
->method('fetchResult')
->with(
"SELECT * FROM `pma_central_columns` WHERE db_name = 'phpmyadmin'"