/** * Test for PMA_getHtmlForServerVariablesItems * * @return void */ public function testPMAGetHtmlForServerVariablesItems() { //Call the test function $variable_doc_links = PMA_getArrayForDocumentLinks(); $html = PMA_getHtmlForServerVariablesItems($variable_doc_links); //validate 1: variable: auto_increment_increment $name = "auto_increment_increment"; $value = htmlspecialchars(str_replace('_', ' ', $name)); $this->assertContains( $value, $html ); //validate 2: variable: auto_increment_offset $name = "auto_increment_offset"; $value = htmlspecialchars(str_replace('_', ' ', $name)); $this->assertContains( $value, $html ); $value = PMA_formatVariable($name, "12", $variable_doc_links); $this->assertContains( $value, $html ); //validate 3: variables $this->assertContains( __('Session value'), $html ); $value = PMA_formatVariable($name, "13", $variable_doc_links); $this->assertContains( $value, $html ); }
/** * Prints Html for Server Variables * * @param Array $variable_doc_links documentation links * * @return string */ function PMA_getHtmlForServerVariables($variable_doc_links) { $value = !empty($_REQUEST['filter']) ? htmlspecialchars($_REQUEST['filter']) : ''; $output = '<fieldset id="tableFilter">' . '<legend>' . __('Filters') . '</legend>' . '<div class="formelement">' . '<label for="filterText">' . __('Containing the word:') . '</label>' . '<input name="filterText" type="text" id="filterText"' . ' style="vertical-align: baseline;" value="' . $value . '" />' . '</div>' . '</fieldset>'; $output .= '<div id="serverVariables" class="data filteredData noclick">' . '<div class="var-header var-row">' . '<div class="var-name">' . __('Variable') . '</div>' . '<div class="var-value valueHeader">' . __('Session value') . ' / ' . __('Global value') . '</div>' . '<div style="clear:both"></div>' . '</div>'; $output .= PMA_getHtmlForServerVariablesItems($variable_doc_links); $output .= '</div>'; return $output; }
/** * Test for PMA_getHtmlForServerVariablesItems * * @return void */ public function testPMAGetHtmlForServerVariablesItems() { //Call the test function $variable_doc_links = PMA_getArrayForDocumentLinks(); $serverVarsSession = $GLOBALS['dbi']->fetchResult('SHOW SESSION VARIABLES;', 0, 1); $serverVars = $GLOBALS['dbi']->fetchResult('SHOW GLOBAL VARIABLES;', 0, 1); $html = PMA_getHtmlForServerVariablesItems($variable_doc_links, $serverVars, $serverVarsSession); //validate 1: variable: auto_increment_increment $name = "auto_increment_increment"; $value = htmlspecialchars(str_replace('_', ' ', $name)); $this->assertContains($value, $html); //validate 2: variable: auto_increment_offset $name = "auto_increment_offset"; $value = htmlspecialchars(str_replace('_', ' ', $name)); $this->assertContains($value, $html); $value = PMA_formatVariable($name, "12", $variable_doc_links); $this->assertContains($value, $html); //validate 3: variables $this->assertContains(__('Session value'), $html); $value = PMA_formatVariable($name, "13", $variable_doc_links); $this->assertContains($value, $html); }