/** * Test for PMA_getDataForSubmitMult * * @return void */ public function testPMAGetDataForSubmitMult() { $submit_mult = "index"; $db = "PMA_db"; $table = "PMA_table"; $selected = array("table1", "table2"); $action = 'db_delete_row'; list($what, $query_type, $is_unset_submit_mult, $mult_btn, $centralColsError) = PMA_getDataForSubmitMult($submit_mult, $db, $table, $selected, $action); //validate 1: $what $this->assertEquals(null, $what); //validate 2: $query_type $this->assertEquals('index_fld', $query_type); //validate 3: $is_unset_submit_mult $this->assertEquals(true, $is_unset_submit_mult); //validate 4: $this->assertEquals(__('Yes'), $mult_btn); //validate 5: $centralColsError $this->assertEquals(null, $centralColsError); $submit_mult = "unique"; list($what, $query_type, $is_unset_submit_mult, $mult_btn, $centralColsError) = PMA_getDataForSubmitMult($submit_mult, $db, $table, $selected, $action); //validate 1: $what $this->assertEquals(null, $what); //validate 2: $query_type $this->assertEquals('unique_fld', $query_type); //validate 3: $is_unset_submit_mult $this->assertEquals(true, $is_unset_submit_mult); //validate 4: $mult_btn $this->assertEquals(__('Yes'), $mult_btn); //validate 5: $centralColsError $this->assertEquals(null, $centralColsError); }
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); break; } // end switch } elseif (isset($selected_fld) && !empty($selected_fld)) { // coming from table structure view - do something with // selected columns $selected = $selected_fld; list($what_ret, $query_type_ret, $is_unset_submit_mult, $mult_btn_ret, $centralColsError) = PMA_getDataForSubmitMult($submit_mult, $GLOBALS['db'], $table, $selected, $action); //update the existing variables if (isset($what_ret)) { $what = $what_ret; } if (isset($query_type_ret)) { $query_type = $query_type_ret; } if ($is_unset_submit_mult) { unset($submit_mult); } if (isset($mult_btn_ret)) { $mult_btn = $mult_btn_ret; } } else { // coming from browsing - do something with selected rows
unset($submit_mult); $mult_btn = __('Yes'); break; case 'export': unset($submit_mult); include 'db_export.php'; exit; break; } // end switch } } elseif (isset($selected_fld) && !empty($selected_fld)) { // coming from table structure view - do something with // selected columns $selected = $selected_fld; list($what_ret, $query_type_ret, $is_unset_submit_mult, $mult_btn_ret) = PMA_getDataForSubmitMult($submit_mult, $db, $table, $selected, $action); //update the existing variables if (isset($what_ret)) { $what = $what_ret; } if (isset($query_type_ret)) { $query_type = $query_type_ret; } if ($is_unset_submit_mult) { unset($submit_mult); } if (isset($mult_btn_ret)) { $mult_btn = $mult_btn_ret; } } else { // coming from browsing - do something with selected rows