/** * 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 ); }
* @package PhpMyAdmin */ require_once 'libraries/common.inc.php'; require_once 'libraries/server_variables.lib.php'; $response = PMA_Response::getInstance(); $header = $response->getHeader(); $scripts = $header->getScripts(); $scripts->addFile('server_variables.js'); /** * Does the common work */ require 'libraries/server_common.inc.php'; /** * Array of documentation links */ $variable_doc_links = PMA_getArrayForDocumentLinks(); /** * Ajax request */ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) { if (isset($_REQUEST['type'])) { if ($_REQUEST['type'] === 'getval') { PMA_getAjaxReturnForGetVal($variable_doc_links); } else { if ($_REQUEST['type'] === 'setval') { PMA_getAjaxReturnForSetVal($variable_doc_links); } } exit; } }
/** * 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); }