/** * 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('<table cellpadding="2" cellspacing="1" id="binlogTable">', $html); //validate 4: PMA_getNavigationRow is right $urlNavigation = 'server_binlog.php?log=log&dontlimitchars=1&' . 'pos=3&server=1&'; $this->assertContains($urlNavigation, $html); $this->assertContains('title="Previous"', $html); //validate 5: Log Item $this->assertContains('Log name', $html); $this->assertContains('Position', $html); $this->assertContains('Event type', $html); $this->assertContains('Server ID', $html); $this->assertContains('Original position', $html); }
* @package PhpMyAdmin */ /** * requirements */ require_once 'libraries/common.inc.php'; /** * Does the common work */ require_once 'libraries/server_common.inc.php'; require_once 'libraries/server_bin_log.lib.php'; /** * array binary log files */ $binary_logs = PMA_DRIZZLE ? null : $GLOBALS['dbi']->fetchResult('SHOW MASTER LOGS', 'Log_name', null, null, PMA_DatabaseInterface::QUERY_STORE); if (!isset($_REQUEST['log']) || !array_key_exists($_REQUEST['log'], $binary_logs)) { $_REQUEST['log'] = ''; } else { $url_params['log'] = $_REQUEST['log']; } if (!empty($_REQUEST['dontlimitchars'])) { $url_params['dontlimitchars'] = 1; } $response = PMA_Response::getInstance(); $response->addHTML(PMA_getHtmlForSubPageHeader('binlog')); $response->addHTML(PMA_getLogSelector($binary_logs, $url_params)); $response->addHTML(PMA_getLogInfo($url_params)); exit; ?> >>>>>>> b875702c9c06ab5012e52ff4337439b03918f453
/** * display the binary logs and the content of the selected * * @package PhpMyAdmin */ /** * requirements */ require_once 'libraries/common.inc.php'; /** * Does the common work */ require_once 'libraries/server_common.inc.php'; require_once 'libraries/server_bin_log.lib.php'; /** * array binary log files */ $binary_logs = PMA_DRIZZLE ? null : $GLOBALS['dbi']->fetchResult('SHOW MASTER LOGS', 'Log_name', null, null, PMA_DatabaseInterface::QUERY_STORE); if (!isset($_REQUEST['log']) || !array_key_exists($_REQUEST['log'], $binary_logs)) { $_REQUEST['log'] = ''; } else { $url_params['log'] = $_REQUEST['log']; } if (!empty($_REQUEST['dontlimitchars'])) { $url_params['dontlimitchars'] = 1; } $response = PMA_Response::getInstance(); $response->addHTML(PMA_getHtmlForSubPageHeader('binlog')); $response->addHTML(PMA_getLogSelector($binary_logs, $url_params)); $response->addHTML(PMA_getLogInfo($binary_logs, $url_params)); exit;