public/phpmyadmin/test/classes/Server/Status/MonitorTest.php
/**
     * Test for Monitor::getJsonForLogDataTypeSlow
     *
     * @return void
     */
Test for Monitor::getJsonForLogDataTypeSlow
@return void
Test for Monitor :: getJsonForLogDataTypeSlow @return void
public function testPMAGetJsonForLogDataTypeSlow()
    {
        $dbi = $this->getMockBuilder('PhpMyAdmin\DatabaseInterface')
            ->disableOriginalConstructor()
            ->getMock();
        $value = array(
            'sql_text' => 'insert sql_text',
            '#' => 11,
        );
        $value2 = array(
            'sql_text' => 'update sql_text',
            '#' => 10,
        );
        $dbi->expects($this->at(1))->method('fetchAssoc')
            ->will($this->returnValue($value));
        $dbi->expects($this->at(2))->method('fetchAssoc')
            ->will($this->returnValue($value2));
        $dbi->expects($this->at(3))->method('fetchAssoc')
            ->will($this->returnValue(false));
        $GLOBALS['dbi'] = $dbi;
        $start = 0;
        $end = 10;
        $ret = Monitor::getJsonForLogDataTypeSlow($start, $end);
        $result_rows = array(
            array('sql_text' => 'insert sql_text', '#' => 11),
            array('sql_text' => 'update sql_text', '#' => 10)
        );
        $result_sum = array('insert' =>11, 'TOTAL' =>21, 'update' => 10);
        $this->assertEquals(
            2,
            $ret['numRows']
        );
        $this->assertEquals(
            $result_rows,
            $ret['rows']
        );
        $this->assertEquals(
            $result_sum,
            $ret['sum']
        );
    }
public function testPMAGetJsonForLogDataTypeSlow ( ) { $ dbi = $ this -> getMockBuilder ( 'PhpMyAdmin\DatabaseInterface' ) -> disableOriginalConstructor ( ) -> getMock ( ) ; $ value = array ( 'sql_text' => 'insert sql_text' , '#' => 11 , ) ; $ value2 = array ( 'sql_text' => 'update sql_text' , '#' => 10 , ) ; $ dbi -> expects ( $ this -> at ( 1 ) ) -> method ( 'fetchAssoc' ) -> will ( $ this -> returnValue ( $ value ) ) ; $ dbi -> expects ( $ this -> at ( 2 ) ) -> method ( 'fetchAssoc' ) -> will ( $ this -> returnValue ( $ value2 ) ) ; $ dbi -> expects ( $ this -> at ( 3 ) ) -> method ( 'fetchAssoc' ) -> will ( $ this -> returnValue ( false ) ) ; $ GLOBALS [ 'dbi' ] = $ dbi ; $ start = 0 ; $ end = 10 ; $ ret = Monitor :: getJsonForLogDataTypeSlow ( $ start , $ end ) ; $ result_rows = array ( array ( 'sql_text' => 'insert sql_text' , '#' => 11 ) , array ( 'sql_text' => 'update sql_text' , '#' => 10 ) ) ; $ result_sum = array ( 'insert' => 11 , 'TOTAL' => 21 , 'update' => 10 ) ; $ this -> assertEquals ( 2 , $ ret [ 'numRows' ] ) ; $ this -> assertEquals ( $ result_rows , $ ret [ 'rows' ] ) ; $ this -> assertEquals ( $ result_sum , $ ret [ 'sum' ] ) ; }
Test for Monitor::getJsonForLogDataTypeSlow
 @return void
Test for Monitor :: getJsonForLogDataTypeSlow @return void
//Mock DBI //Call the test function