Merge pull request #586 from adamgsoc2013/ut_plu_dbi
fix DBI mocking for cases of schema
This commit is contained in:
commit
7c09b481ae
@ -46,11 +46,22 @@ class PMA_Dia_Relation_Schema_Test extends PHPUnit_Framework_TestCase
|
||||
$_POST['orientation'] = 'orientation';
|
||||
$_POST['paper'] = 'paper';
|
||||
$_POST['export_type'] = 'PMA_ExportType';
|
||||
|
||||
$GLOBALS['server'] = 1;
|
||||
$GLOBALS['controllink'] = null;
|
||||
$GLOBALS['db'] = 'information_schema';
|
||||
$GLOBALS['cfg']['ServerDefault'] = 1;
|
||||
$GLOBALS['cfg']['Server']['table_coords'] = "table_name";
|
||||
$GLOBALS['cfgRelation']['db'] = "PMA";
|
||||
$GLOBALS['cfgRelation']['table_coords'] = "table_name";
|
||||
|
||||
//_SESSION
|
||||
$_SESSION['relation'][$GLOBALS['server']] = array(
|
||||
'table_coords' => "table_name",
|
||||
'displaywork' => 'displaywork',
|
||||
'db' => "information_schema",
|
||||
'table_info' => 'table_info',
|
||||
'relwork' => 'relwork',
|
||||
'relation' => 'relation'
|
||||
);
|
||||
|
||||
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
|
||||
->disableOriginalConstructor()
|
||||
@ -69,13 +80,22 @@ class PMA_Dia_Relation_Schema_Test extends PHPUnit_Framework_TestCase
|
||||
->will($this->returnValue("executed_1"));
|
||||
|
||||
$fetchArrayReturn = array(
|
||||
'table_name' => 'pma_table_name'
|
||||
//table name in information_schema_relations
|
||||
'table_name' => 'CHARACTER_SETS'
|
||||
);
|
||||
|
||||
$fetchArrayReturn2 = array(
|
||||
//table name in information_schema_relations
|
||||
'table_name' => 'COLLATIONS'
|
||||
);
|
||||
|
||||
$dbi->expects($this->at(2))
|
||||
->method('fetchAssoc')
|
||||
->will($this->returnValue($fetchArrayReturn));
|
||||
$dbi->expects($this->at(3))
|
||||
->method('fetchAssoc')
|
||||
->will($this->returnValue($fetchArrayReturn2));
|
||||
$dbi->expects($this->at(4))
|
||||
->method('fetchAssoc')
|
||||
->will($this->returnValue(false));
|
||||
|
||||
@ -101,7 +121,7 @@ class PMA_Dia_Relation_Schema_Test extends PHPUnit_Framework_TestCase
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 "
|
||||
. "COLLATE=utf8_bin COMMENT='Bookmarks'";
|
||||
|
||||
$dbi->expects($this->once())
|
||||
$dbi->expects($this->any())
|
||||
->method('fetchValue')
|
||||
->will($this->returnValue($fetchValue));
|
||||
|
||||
|
||||
@ -48,10 +48,20 @@ class PMA_Eps_Relation_Schema_Test extends PHPUnit_Framework_TestCase
|
||||
$_POST['paper'] = 'paper';
|
||||
$_POST['export_type'] = 'PMA_ExportType';
|
||||
$GLOBALS['server'] = 1;
|
||||
$GLOBALS['controllink'] = null;
|
||||
$GLOBALS['db'] = 'information_schema';
|
||||
$GLOBALS['cfg']['ServerDefault'] = 1;
|
||||
$GLOBALS['cfg']['Server']['table_coords'] = "table_name";
|
||||
$GLOBALS['cfgRelation']['db'] = "PMA";
|
||||
$GLOBALS['cfgRelation']['table_coords'] = "table_name";
|
||||
|
||||
//_SESSION
|
||||
$_SESSION['relation'][$GLOBALS['server']] = array(
|
||||
'table_coords' => "table_name",
|
||||
'displaywork' => 'displaywork',
|
||||
'db' => "information_schema",
|
||||
'table_info' => 'table_info',
|
||||
'relwork' => 'relwork',
|
||||
'relation' => 'relation'
|
||||
);
|
||||
|
||||
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
|
||||
->disableOriginalConstructor()
|
||||
@ -70,13 +80,22 @@ class PMA_Eps_Relation_Schema_Test extends PHPUnit_Framework_TestCase
|
||||
->will($this->returnValue("executed_1"));
|
||||
|
||||
$fetchArrayReturn = array(
|
||||
'table_name' => 'pma_table_name'
|
||||
//table name in information_schema_relations
|
||||
'table_name' => 'CHARACTER_SETS'
|
||||
);
|
||||
|
||||
$fetchArrayReturn2 = array(
|
||||
//table name in information_schema_relations
|
||||
'table_name' => 'COLLATIONS'
|
||||
);
|
||||
|
||||
$dbi->expects($this->at(2))
|
||||
->method('fetchAssoc')
|
||||
->will($this->returnValue($fetchArrayReturn));
|
||||
$dbi->expects($this->at(3))
|
||||
->method('fetchAssoc')
|
||||
->will($this->returnValue($fetchArrayReturn2));
|
||||
$dbi->expects($this->at(4))
|
||||
->method('fetchAssoc')
|
||||
->will($this->returnValue(false));
|
||||
|
||||
@ -102,7 +121,7 @@ class PMA_Eps_Relation_Schema_Test extends PHPUnit_Framework_TestCase
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 "
|
||||
. "COLLATE=utf8_bin COMMENT='Bookmarks'";
|
||||
|
||||
$dbi->expects($this->once())
|
||||
$dbi->expects($this->any())
|
||||
->method('fetchValue')
|
||||
->will($this->returnValue($fetchValue));
|
||||
|
||||
|
||||
@ -49,10 +49,20 @@ class PMA_Svg_Relation_Schema_Test extends PHPUnit_Framework_TestCase
|
||||
$_POST['export_type'] = 'PMA_ExportType';
|
||||
$_POST['with_doc'] = 'on';
|
||||
$GLOBALS['server'] = 1;
|
||||
$GLOBALS['controllink'] = null;
|
||||
$GLOBALS['db'] = 'information_schema';
|
||||
$GLOBALS['cfg']['ServerDefault'] = 1;
|
||||
$GLOBALS['cfg']['Server']['table_coords'] = "table_name";
|
||||
$GLOBALS['cfgRelation']['db'] = "PMA";
|
||||
$GLOBALS['cfgRelation']['table_coords'] = "table_name";
|
||||
|
||||
//_SESSION
|
||||
$_SESSION['relation'][$GLOBALS['server']] = array(
|
||||
'table_coords' => "table_name",
|
||||
'displaywork' => 'displaywork',
|
||||
'db' => "information_schema",
|
||||
'table_info' => 'table_info',
|
||||
'relwork' => 'relwork',
|
||||
'relation' => 'relation'
|
||||
);
|
||||
|
||||
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
|
||||
->disableOriginalConstructor()
|
||||
@ -71,13 +81,22 @@ class PMA_Svg_Relation_Schema_Test extends PHPUnit_Framework_TestCase
|
||||
->will($this->returnValue("executed_1"));
|
||||
|
||||
$fetchArrayReturn = array(
|
||||
'table_name' => 'pma_table_name'
|
||||
//table name in information_schema_relations
|
||||
'table_name' => 'CHARACTER_SETS'
|
||||
);
|
||||
|
||||
$fetchArrayReturn2 = array(
|
||||
//table name in information_schema_relations
|
||||
'table_name' => 'COLLATIONS'
|
||||
);
|
||||
|
||||
$dbi->expects($this->at(2))
|
||||
->method('fetchAssoc')
|
||||
->will($this->returnValue($fetchArrayReturn));
|
||||
$dbi->expects($this->at(3))
|
||||
->method('fetchAssoc')
|
||||
->will($this->returnValue($fetchArrayReturn2));
|
||||
$dbi->expects($this->at(4))
|
||||
->method('fetchAssoc')
|
||||
->will($this->returnValue(false));
|
||||
|
||||
@ -103,7 +122,7 @@ class PMA_Svg_Relation_Schema_Test extends PHPUnit_Framework_TestCase
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 "
|
||||
. "COLLATE=utf8_bin COMMENT='Bookmarks'";
|
||||
|
||||
$dbi->expects($this->once())
|
||||
$dbi->expects($this->any())
|
||||
->method('fetchValue')
|
||||
->will($this->returnValue($fetchValue));
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user