From 24014834509f0259731dd4600af7969474130e97 Mon Sep 17 00:00:00 2001 From: xmujay Date: Mon, 22 Jul 2013 21:34:41 +0800 Subject: [PATCH] UTs for PMA_display_export --- test/libraries/PMA_display_export_test.php | 239 +++++++++++++++++++++ 1 file changed, 239 insertions(+) create mode 100644 test/libraries/PMA_display_export_test.php diff --git a/test/libraries/PMA_display_export_test.php b/test/libraries/PMA_display_export_test.php new file mode 100644 index 0000000000..8475c27890 --- /dev/null +++ b/test/libraries/PMA_display_export_test.php @@ -0,0 +1,239 @@ +getMockBuilder('PMA_Config') + ->disableOriginalConstructor() + ->getMock(); + + $pmaconfig->expects($this->any()) + ->method('getUserValue') + ->will($this->returnValue('user value for test')); + + $GLOBALS['PMA_Config'] = $pmaconfig; + } + + /** + * Test for PMA_getHtmlForHiddenInput + * + * @return void + */ + public function testPMAGetHtmlForHiddenInput() + { + $export_type = "server"; + $db = "PMA"; + $table = "PMA_test"; + $single_table_str = "PMA_single_str"; + $sql_query_str = "sql_query_str"; + + //Call the test function + $html = PMA_getHtmlForHiddenInput( + $export_type, + $db, + $table, + $single_table_str, + $sql_query_str + ); + + //validate 1: PMA_generate_common_hidden_inputs + //$single_table + $this->assertContains( + 'assertContains( + 'assertContains( + ' $export_type, + 'single_table' => isset($single_table) + ) + ); + + //Call the test function + $html = PMA_getHtmlForExportOptions( + $export_type, + $db, + $table, + $multi_values_str, + $num_tables_str, + $export_list, + $unlim_num_rows_str + ); + + //validate 1: PMA_getHtmlForExportOptionHeader + $this->assertContains( + '