"index1", "File_size"=>100); $binary_log_file_names[] = array("Log_name"=>"index2", "File_size"=>200); $url_params = array(); $url_params['log'] = "log"; $url_params['dontlimitchars'] = 1; $html = PMA_getLogSelector($binary_log_file_names, $url_params); $this->assertContains( 'Select binary log to view', $html ); $this->assertContains( '', $html ); $this->assertContains( '', $html ); } /** * Test for PMA_getLogInfo * * @return void * @group medium */ public function testPMAGetLogInfo() { $url_params = array(); $url_params['log'] = "log"; $url_params['dontlimitchars'] = 1; //Mock DBI $dbi = $this->getMockBuilder('PMA_DatabaseInterface') ->disableOriginalConstructor() ->getMock(); //expects return value $result = array( array( "SHOW BINLOG EVENTS IN 'index1' LIMIT 3, 10", null, 1, true, array("log1"=>"logd") ), array( array("log2"=>"logb"), null, 0, false, 'executed' ) ); $value = array( 'Info' => "index1_Info", 'Log_name' => "index1_Log_name", 'Pos' => "index1_Pos", 'Event_type' => "index1_Event_type", 'End_log_pos' => "index1_End_log_pos", 'Server_id' => "index1_Server_id", ); $count = 3; //expects functions $dbi->expects($this->once())->method('query') ->will($this->returnValue($result)); $dbi->expects($this->once())->method('numRows') ->will($this->returnValue($count)); $dbi->expects($this->at(0))->method('fetchAssoc') ->will($this->returnValue($value)); $dbi->expects($this->at(1))->method('fetchAssoc') ->will($this->returnValue(false)); $GLOBALS['dbi'] = $dbi; //Call the test function $html = PMA_getLogInfo($url_params); //validate 1: the sql has been executed $this->assertContains( 'Your SQL query has been executed successfully', $html ); //validate 2: SQL $this->assertContains( "SHOW BINLOG EVENTS IN 'index1' LIMIT 3, 10", $html ); //validate 3: BINLOG HTML $this->assertContains( '