public/phpmyadmin/test/classes/Server/Status/MonitorTest.php
/**
     * Test for Monitor::getJsonForQueryAnalyzer
     *
     * @return void
     */
Test for Monitor::getJsonForQueryAnalyzer
@return void
Test for Monitor :: getJsonForQueryAnalyzer @return void
public function testPMAGetJsonForQueryAnalyzer()
    {
        $_POST['database'] = "database";
        $_POST['query'] = 'query';
        $GLOBALS['server'] = 'server';
        $GLOBALS['cached_affected_rows'] = 'cached_affected_rows';
        $_SESSION['cache']['server_server']['profiling_supported'] = true;
        $dbi = $this->getMockBuilder('PhpMyAdmin\DatabaseInterface')
            ->disableOriginalConstructor()
            ->getMock();
        $value = array(
            'sql_text' => 'insert sql_text',
            '#' => 33,
            'argument' => 'argument argument2',
        );
        $dbi->expects($this->at(4))->method('fetchAssoc')
            ->will($this->returnValue($value));
        $dbi->expects($this->at(5))->method('fetchAssoc')
            ->will($this->returnValue(false));
        $GLOBALS['dbi'] = $dbi;
        $ret = Monitor::getJsonForQueryAnalyzer();
        $this->assertEquals(
            'cached_affected_rows',
            $ret['affectedRows']
        );
        $this->assertEquals(
            array(),
            $ret['profiling']
        );
        $this->assertEquals(
            array($value),
            $ret['explain']
        );
    }
public function testPMAGetJsonForQueryAnalyzer ( ) { $ _POST [ 'database' ] = " database " ; $ _POST [ 'query' ] = 'query' ; $ GLOBALS [ 'server' ] = 'server' ; $ GLOBALS [ 'cached_affected_rows' ] = 'cached_affected_rows' ; $ _SESSION [ 'cache' ] [ 'server_server' ] [ 'profiling_supported' ] = true ; $ dbi = $ this -> getMockBuilder ( 'PhpMyAdmin\DatabaseInterface' ) -> disableOriginalConstructor ( ) -> getMock ( ) ; $ value = array ( 'sql_text' => 'insert sql_text' , '#' => 33 , 'argument' => 'argument argument2' , ) ; $ dbi -> expects ( $ this -> at ( 4 ) ) -> method ( 'fetchAssoc' ) -> will ( $ this -> returnValue ( $ value ) ) ; $ dbi -> expects ( $ this -> at ( 5 ) ) -> method ( 'fetchAssoc' ) -> will ( $ this -> returnValue ( false ) ) ; $ GLOBALS [ 'dbi' ] = $ dbi ; $ ret = Monitor :: getJsonForQueryAnalyzer ( ) ; $ this -> assertEquals ( 'cached_affected_rows' , $ ret [ 'affectedRows' ] ) ; $ this -> assertEquals ( array ( ) , $ ret [ 'profiling' ] ) ; $ this -> assertEquals ( array ( $ value ) , $ ret [ 'explain' ] ) ; }
Test for Monitor::getJsonForQueryAnalyzer
 @return void
Test for Monitor :: getJsonForQueryAnalyzer @return void
//Mock DBI //Call the test function