/** * Test for PMA_getTableDropQueryAndMessage * * @return void */ public function testPMAGetTableDropQueryAndMessage() { $current_table = array('TABLE_ROWS' => 3, 'TABLE_NAME' => 'name1', 'ENGINE' => 'ENGINE1'); $table_is_view = false; list($drop_query, $drop_message) = PMA_getTableDropQueryAndMessage($table_is_view, $current_table); //$drop_query $ret = "DROP TABLE `name1`"; $this->assertEquals($ret, $drop_query); //$drop_message $ret = "Table name1 has been dropped."; $this->assertEquals($ret, $drop_message); }
if ($table_is_view) { $hidden_fields[] = '<input type="hidden" name="views[]" value="' . htmlspecialchars($current_table['TABLE_NAME']) . '" />'; } /* * Always activate links for Browse, Search and Empty, even if * the icons are greyed, because * 1. for views, we don't know the number of rows at this point * 2. for tables, another source could have populated them since the * page was generated * * I could have used the PHP ternary conditional operator but I find * the code easier to read without this operator. */ list($browse_table, $search_table, $browse_table_label, $empty_table, $tracking_icon) = PMA_getHtmlForActionLinks($current_table, $table_is_view, $tbl_url_query, $titles, $truename, $db_is_information_schema, $url_query); if (!$db_is_information_schema) { list($drop_query, $drop_message) = PMA_getTableDropQueryAndMessage($table_is_view, $current_table); } if ($num_columns > 0 && $num_tables > $num_columns && $row_count % $num_columns == 0) { $row_count = 1; $odd_row = true; $response->addHTML('</tr></tbody></table>'); $response->addHTML(PMA_tableHeader(false, $server_slave_status)); } list($do, $ignored) = PMA_getServerSlaveStatus($server_slave_status, $truename); list($html_output, $odd_row) = PMA_getHtmlForStructureTableRow($i, $odd_row, $table_is_view, $current_table, $browse_table_label, $tracking_icon, $server_slave_status, $browse_table, $tbl_url_query, $search_table, $db_is_information_schema, $titles, $empty_table, $drop_query, $drop_message, $collation, $formatted_size, $unit, $overhead, isset($create_time) ? $create_time : '', isset($update_time) ? $update_time : '', isset($check_time) ? $check_time : '', $is_show_stats, $ignored, $do, $colspan_for_structure); $response->addHTML($html_output); } // end foreach // Show Summary $response->addHTML('</tbody>'); $response->addHTML(PMA_getHtmlBodyForTableSummary($num_tables, $server_slave_status, $db_is_information_schema, $sum_entries, $db_collation, $is_show_stats, $sum_size, $overhead_size, $create_time_all, $update_time_all, $check_time_all, $sum_row_count_pre));