case 'check_tbl': case 'optimize_tbl': case 'repair_tbl': case 'analyze_tbl': case 'checksum_tbl': $query_type = $submit_mult; unset($submit_mult); $mult_btn = __('Yes'); break; case 'export': unset($submit_mult); include 'db_export.php'; exit; break; case 'show_create': $show_create = PMA_getHtmlShowCreate($GLOBALS['db'], $selected); // Send response to client. $response = PMA_Response::getInstance(); $response->addJSON('message', $show_create); exit; case 'sync_unique_columns_central_list': include_once 'libraries/central_columns.lib.php'; $centralColsError = PMA_syncUniqueColumns($selected); break; case 'delete_unique_columns_central_list': include_once 'libraries/central_columns.lib.php'; $centralColsError = PMA_deleteColumnsFromList($selected); break; case 'make_consistent_with_central_list': include_once 'libraries/central_columns.lib.php'; $centralColsError = PMA_makeConsistentWithList($GLOBALS['db'], $selected);
/** * Test for PMA_getHtmlShowCreate * * @return void */ public function testPMAGetHtmlShowCreate() { //mock DBI $dbi = $this->getMockBuilder('PMA_DatabaseInterface')->disableOriginalConstructor()->getMock(); $db = 'PMA'; $table = 'PMA_Table'; $is_view_query = "SELECT TABLE_NAME\n FROM information_schema.VIEWS\n WHERE TABLE_SCHEMA = '" . PMA_Util::sqlAddSlashes($db) . "'\n AND TABLE_NAME = '" . PMA_Util::sqlAddSlashes($table) . "'"; $show_create_query = 'SHOW CREATE TABLE ' . PMA_Util::backquote($db) . '.' . PMA_Util::backquote($table); $expected_result = 'CREATE TABLE `PMA_Table` ( ' . '`id` numeric ' . ') ENGINE=InnoDB DEFAULT CHARSET=latin1'; $dbi->expects($this->any())->method('fetchResult')->with($is_view_query)->will($this->returnValue(false)); $dbi->expects($this->any())->method('fetchSingleRow')->with($show_create_query)->will($this->returnValue(array('Table' => 'PMA_Table', 'Create Table' => $expected_result))); $GLOBALS['dbi'] = $dbi; $output = PMA_getHtmlShowCreate($db, array($table)); $this->assertContains('Showing create queries', $output); $this->assertContains('<legend>Tables</legend><table class="show_create">', $output); $this->assertContains('<th>Create Table</th>', $output); $this->assertContains(PMA_mimeDefaultFunction($expected_result), $output); }