Skip to content

Commit

Permalink
refactor case for schema
Browse files Browse the repository at this point in the history
  • Loading branch information
adamgsoc2013 committed Aug 11, 2013
1 parent d467f44 commit 4ee99d6
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 12 deletions.
28 changes: 24 additions & 4 deletions test/classes/schema/Dia_Relation_Schema_test.php
Expand Up @@ -46,11 +46,22 @@ protected function setUp()
$_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()
Expand All @@ -69,13 +80,22 @@ protected function setUp()
->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));

Expand All @@ -101,7 +121,7 @@ protected function setUp()
) 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));

Expand Down
27 changes: 23 additions & 4 deletions test/classes/schema/Eps_Relation_Schema_test.php
Expand Up @@ -48,10 +48,20 @@ protected function setUp()
$_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()
Expand All @@ -70,13 +80,22 @@ protected function setUp()
->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));

Expand All @@ -102,7 +121,7 @@ protected function setUp()
) 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));

Expand Down
27 changes: 23 additions & 4 deletions test/classes/schema/Svg_Relation_Schema_test.php
Expand Up @@ -49,10 +49,20 @@ protected function setUp()
$_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()
Expand All @@ -71,13 +81,22 @@ protected function setUp()
->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));

Expand All @@ -103,7 +122,7 @@ protected function setUp()
) 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));

Expand Down

0 comments on commit 4ee99d6

Please sign in to comment.