public/phpmyadmin/test/classes/Controllers/Server/ServerVariablesControllerTest.php
/**
     * Test for _getHtmlForServerVariablesItems()
     *
     * @return void
     */
Test for _getHtmlForServerVariablesItems()
@return void
Test for _getHtmlForServerVariablesItems () @return void
public function testGetHtmlForServerVariablesItems()
    {
        $class = new ReflectionClass(
            '\PhpMyAdmin\Controllers\Server\ServerVariablesController'
        );
        $method = $class->getMethod('_getHtmlForServerVariablesItems');
        $method->setAccessible(true);
        $container = Container::getDefaultContainer();
        $container->factory(
            'PhpMyAdmin\Controllers\Server\ServerVariablesController'
        );
        $container->alias(
            'ServerVariablesController',
            'PhpMyAdmin\Controllers\Server\ServerVariablesController'
        );
        $ctrl = $container->get('ServerVariablesController');
        $serverVarsSession
            = $GLOBALS['dbi']->fetchResult('SHOW SESSION VARIABLES;', 0, 1);
        $serverVars = $GLOBALS['dbi']->fetchResult('SHOW GLOBAL VARIABLES;', 0, 1);
        $html = $method->invoke($ctrl, $serverVars, $serverVarsSession);
        $name = "auto_increment_increment";
        $value = htmlspecialchars(str_replace('_', ' ', $name));
        $this->assertContains(
            $value,
            $html
        );
        $name = "auto_increment_offset";
        $value = htmlspecialchars(str_replace('_', ' ', $name));
        $this->assertContains(
            $value,
            $html
        );
        $formatVariable = $class->getMethod('_formatVariable');
        $formatVariable->setAccessible(true);
        $args = array($name, "12");
        list($value, $isHtmlFormatted) = $formatVariable->invokeArgs($ctrl, $args);
        $this->assertContains(
            $value,
            $html
        );
        $this->assertContains(
            __('Session value'),
            $html
        );
        $args = array($name, "13");
        list($value, $isHtmlFormatted) = $formatVariable->invokeArgs($ctrl, $args);
        $this->assertContains(
            $value,
            $html
        );
    }
public function testGetHtmlForServerVariablesItems ( ) { $ class = new ReflectionClass ( '\PhpMyAdmin\Controllers\Server\ServerVariablesController' ) ; $ method = $ class -> getMethod ( '_getHtmlForServerVariablesItems' ) ; $ method -> setAccessible ( true ) ; $ container = Container :: getDefaultContainer ( ) ; $ container -> factory ( 'PhpMyAdmin\Controllers\Server\ServerVariablesController' ) ; $ container -> alias ( 'ServerVariablesController' , 'PhpMyAdmin\Controllers\Server\ServerVariablesController' ) ; $ ctrl = $ container -> get ( 'ServerVariablesController' ) ; $ serverVarsSession = $ GLOBALS [ 'dbi' ] -> fetchResult ( 'SHOW SESSION VARIABLES;' , 0 , 1 ) ; $ serverVars = $ GLOBALS [ 'dbi' ] -> fetchResult ( 'SHOW GLOBAL VARIABLES;' , 0 , 1 ) ; $ html = $ method -> invoke ( $ ctrl , $ serverVars , $ serverVarsSession ) ; $ name = " auto_increment_increment " ; $ value = htmlspecialchars ( str_replace ( '_' , ' ' , $ name ) ) ; $ this -> assertContains ( $ value , $ html ) ; $ name = " auto_increment_offset " ; $ value = htmlspecialchars ( str_replace ( '_' , ' ' , $ name ) ) ; $ this -> assertContains ( $ value , $ html ) ; $ formatVariable = $ class -> getMethod ( '_formatVariable' ) ; $ formatVariable -> setAccessible ( true ) ; $ args = array ( $ name , " 12 " ) ; list ( $ value , $ isHtmlFormatted ) = $ formatVariable -> invokeArgs ( $ ctrl , $ args ) ; $ this -> assertContains ( $ value , $ html ) ; $ this -> assertContains ( __ ( 'Session value' ) , $ html ) ; $ args = array ( $ name , " 13 " ) ; list ( $ value , $ isHtmlFormatted ) = $ formatVariable -> invokeArgs ( $ ctrl , $ args ) ; $ this -> assertContains ( $ value , $ html ) ; }
Test for _getHtmlForServerVariablesItems()
 @return void
Test for _getHtmlForServerVariablesItems () @return void
//validate 1: variable: auto_increment_increment //validate 2: variable: auto_increment_offset //validate 3: variables