private function ReportEvent(Event &$event) { $report = ''; $type = $event->GetType(); /* if (//EventType::USER_MSG() != $type || //EventType::PASS_MSG() != $type || EventType::FAIL_MSG() == $type) { $report .= 'Reason: ' . $event->GetReason() . PHP_EOL; } */ if (EventType::FAIL() == $type || EventType::ERROR() == $type) { $report .= "\tFailed Message: " . $event->GetMessage() . "\tSee detail" . PHP_EOL . "\tActual Type: " . $event->GetActualType() . "\tValue: " . $event->GetActualValue() . PHP_EOL . "\tComparison Type: " . $event->GetComparisonType() . "\tValue: " . $event->GetComparisonValue() . PHP_EOL . "\tFile: " . $event->GetFile() . " Line: " . $event->GetLine() . PHP_EOL; } else { if (EventType::EXCEPTION_THROWN() == $type) { $report .= "\tException: " . $event->GetReason() . PHP_EOL; $report .= "\t " . $event->GetMessage() . PHP_EOL; } } return $report; }
private function ReportEvent(Event &$event) { $report = ' <type>' . htmlentities($event->GetTypeAsString()) . "</type>\n"; $report .= ' <time>' . htmlentities($event->GetTime()) . "</time>\n"; $type = $event->GetType(); if (EventType::START_SETUP() == $type || EventType::END_SETUP() == $type || EventType::START_RUN() == $type || EventType::END_RUN() == $type || EventType::START_TEAR_DOWN() == $type || EventType::END_TEAR_DOWN() == $type) { return $report; } if (EventType::USER_MSG() != $type || EventType::PASS_MSG() != $type || EventType::FAIL_MSG() != $type) { $report .= ' <reason>' . htmlentities($event->GetReason()) . "</reason>\n"; } if (EventType::SYS_MSG() != $type) { $report .= ' <message>' . htmlentities($event->GetMessage()) . "</message>\n"; } if (EventType::SYS_MSG() != $type && EventType::USER_MSG() != $type && EventType::FAIL_MSG() != $type && EventType::PASS_MSG() != $type && EventType::EXCEPTION_THROWN() != $type) { $report .= " <actual>\n" . ' <type>' . htmlentities($event->GetActualType()) . "</type>\n" . ' <value>' . htmlentities($event->GetActualValue()) . "</value></actual>\n"; $report .= " <comparison>\n" . ' <type>' . htmlentities($event->GetComparisonType()) . "</type>\n" . ' <value>' . htmlentities($event->GetComparisonValue()) . "</value></comparison>\n"; } if (EventType::SYS_MSG() != $type) { $report .= ' <file>' . htmlentities($event->GetFile()) . "</file>\n"; $report .= ' <line>' . htmlentities($event->GetLine()) . "</line>\n"; } return $report; }
public function AddException($place, Exception &$exception) { $this->success = false; $this->testEvents[] = new Event(EventType::EXCEPTION_THROWN(), $place, $exception->getMessage(), null, null, $exception->getFile(), $exception->getLine()); }