public function testBackupDataCount() { $myobj = new TicketCorrelator(); $myobj->printHeader(); $this->assertGreaterThanOrEqual(10, $myobj->RECORD_COUNT, "Minimum 10 records should be available in Backup file"); }
$this->drawBackupTable(); echo "</table><br><center><input type='submit' name='Generate Ticket' value='Correlate Failures'></center></form>"; } function drawBackupTable() { $cnt = 0; $myfile = fopen($this->BACKUP_FILE, "r") or die("Unable to open file for reading"); echo "<font size=5 {$this->TITLESTYLE} ><b>Customer Backup Jobs Status Dashboard</b></font><br><br> <form action='' name='myform' method='post'>"; echo "<center><table border=1 width=60% align=center><tr><th {$this->HEADSTYLE}>Customer</th><th {$this->HEADSTYLE}>Nodename</th><th {$this->HEADSTYLE}>Policy</th><th {$this->HEADSTYLE}>Backup Type</th><th {$this->HEADSTYLE}>Exit Code</th><th {$this->HEADSTYLE}>Created Time</th></tr>"; while (!feof($myfile)) { $data = fgets($myfile); if (preg_match("/^Nodename##Policy##BackupType##ExitCode##Time/", $data) || preg_match("/^#.*/", $data) || preg_match("/^\n/", $data)) { continue; } $result = explode("##", $data); if (count($result) < 6) { continue; } $STYLE = $this->ALTSTYLE; if ($cnt % 2 == 0) { $STYLE = $this->BGSTYLE; } $cnt++; echo "<tr><td {$STYLE}>{$result['5']}</td><td {$STYLE}>{$result['0']}</td><td {$STYLE}>{$result['1']}</td><td {$STYLE}>{$result['2']}</td><td {$STYLE}>{$result['3']}</td><td {$STYLE}>{$result['4']}</td></tr>"; } fclose($myfile); $this->RECORD_COUNT = $cnt; } } $myclass = new TicketCorrelator(); $myclass->printHeader();