getMockBuilder('PhpMyAdmin\Config') ->disableOriginalConstructor() ->getMock(); $pmaconfig->expects($this->any()) ->method('getUserValue') ->will($this->returnValue('user value for test')); $GLOBALS['PMA_Config'] = $pmaconfig; $this->export = new Export(); } /** * Test for Export::getHtmlForHiddenInputs * * @return void */ public function testGetHtmlForHiddenInputs() { $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 = $this->export->getHtmlForHiddenInputs( $export_type, $db, $table, $single_table_str, $sql_query_str ); //validate 1: Url::getHiddenInputs //$single_table $this->assertContains( 'assertContains( 'assertContains( 'cacheTableContent([$db, $table, 'ENGINE'], 'MERGE'); $columns_info = [ 'test_column1' => [ 'COLUMN_NAME' => 'test_column1' ], 'test_column2' => [ 'COLUMN_NAME' => 'test_column2' ] ]; $dbi = $this->getMockBuilder('PhpMyAdmin\DatabaseInterface') ->disableOriginalConstructor() ->getMock(); $dbi->expects($this->any())->method('getColumnsFull') ->will($this->returnValue($columns_info)); $dbi->expects($this->any())->method('getCompatibilities') ->will($this->returnValue([])); $GLOBALS['dbi'] = $dbi; /* Scan for plugins */ $export_list = Plugins::getPlugins( "export", 'libraries/classes/Plugins/Export/', [ 'export_type' => $export_type, 'single_table' => true,// isset($single_table) ] ); //Call the test function $html = $this->export->getHtmlForOptions( $export_type, $db, $table, $multi_values_str, $num_tables_str, $export_list, $unlim_num_rows_str ); //validate 2: Export::getHtmlForOptionsMethod $this->assertContains( $cfg['Export']['method'], $html ); $this->assertContains( '