From 4ee99d653fb6dbe480efb3b3ad0980ae506aadab Mon Sep 17 00:00:00 2001 From: adamgsoc2013 Date: Sun, 11 Aug 2013 21:31:18 +0800 Subject: [PATCH] refactor case for schema --- .../schema/Dia_Relation_Schema_test.php | 28 ++++++++++++++++--- .../schema/Eps_Relation_Schema_test.php | 27 +++++++++++++++--- .../schema/Svg_Relation_Schema_test.php | 27 +++++++++++++++--- 3 files changed, 70 insertions(+), 12 deletions(-) diff --git a/test/classes/schema/Dia_Relation_Schema_test.php b/test/classes/schema/Dia_Relation_Schema_test.php index 87f684e6ee7b..43ad2fa37c63 100644 --- a/test/classes/schema/Dia_Relation_Schema_test.php +++ b/test/classes/schema/Dia_Relation_Schema_test.php @@ -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() @@ -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)); @@ -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)); diff --git a/test/classes/schema/Eps_Relation_Schema_test.php b/test/classes/schema/Eps_Relation_Schema_test.php index 871dc07d8e4f..ea7862798732 100644 --- a/test/classes/schema/Eps_Relation_Schema_test.php +++ b/test/classes/schema/Eps_Relation_Schema_test.php @@ -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() @@ -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)); @@ -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)); diff --git a/test/classes/schema/Svg_Relation_Schema_test.php b/test/classes/schema/Svg_Relation_Schema_test.php index b8343924a773..2640bafa8874 100644 --- a/test/classes/schema/Svg_Relation_Schema_test.php +++ b/test/classes/schema/Svg_Relation_Schema_test.php @@ -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() @@ -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)); @@ -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));