status['Uptime'] = 36000;
$data->status['Bytes_received'] = $bytesReceived;
$data->status['Bytes_sent'] = $bytesSent;
$data->status['Max_used_connections'] = $maxUsedConnections;
$data->status['Aborted_connects'] = $abortedConnections;
$data->status['Connections'] = $connections;
$response = new ResponseRenderer();
$template = new Template();
$controller = new StatusController(
$response,
$template,
$data,
new ReplicationGui(new Replication(), $template),
$GLOBALS['dbi']
);
$replicationInfo = $data->getReplicationInfo();
$replicationInfo->primaryVariables = [];
$replicationInfo->replicaVariables = [];
$this->dummyDbi->addSelectDb('mysql');
$controller();
$this->assertAllSelectsConsumed();
$html = $response->getHTMLResult();
$traffic = $bytesReceived + $bytesSent;
$trafficHtml = 'Network traffic since startup: ' . $traffic . ' B';
$this->assertStringContainsString(
$trafficHtml,
$html
);
//updatetime
$upTimeHtml = 'This MySQL server has been running for '
. '0 days, 10 hours, 0 minutes and 0 seconds';
$this->assertStringContainsString(
$upTimeHtml,
$html
);
//master state
$masterHtml = 'This MySQL server works as master';
$this->assertStringContainsString(
$masterHtml,
$html
);
//validate 2: Status::getHtmlForServerStateTraffic
$trafficHtml = '
';
$this->assertStringContainsString(
$trafficHtml,
$html
);
//traffic hint
$trafficHtml = 'On a busy server, the byte counters may overrun';
$this->assertStringContainsString(
$trafficHtml,
$html
);
//$bytes_received
$this->assertStringContainsString(
'| ' . $bytesReceived . ' B',
$html
);
//$bytes_sent
$this->assertStringContainsString(
' | ' . $bytesSent . ' B',
$html
);
//validate 3: Status::getHtmlForServerStateConnections
$this->assertStringContainsString(
' | Connections | ',
$html
);
$this->assertStringContainsString(
'ΓΈ per hour | ',
$html
);
$this->assertStringContainsString(
'',
$html
);
$this->assertStringContainsString(
'| Max. concurrent connections | ',
$html
);
//Max_used_connections
$this->assertStringContainsString(
'' . $maxUsedConnections,
$html
);
$this->assertStringContainsString(
' | Failed attempts | ',
$html
);
//Aborted_connects
$this->assertStringContainsString(
'' . $abortedConnections,
$html
);
$this->assertStringContainsString(
' | Aborted | ',
$html
);
}
}