public endStoryplayer ( float $duration ) : void | ||
$duration | float | duration in seconds |
return | void |
public function endStoryplayer($duration)
{
// generate the XML
$junitxml = '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL;
$junitxml .= '<testsuite' . ' id="' . $this->testsuite['id'] . '"' . ' name="' . $this->testsuite['name'] . '"' . ' tests="' . $this->testsuite['tests'] . '"' . ' disabled="' . $this->testsuite['disabled'] . '"' . ' errors="' . $this->testsuite['errors'] . '"' . ' failures="' . $this->testsuite['failures'] . '"' . ' skipped="' . $this->testsuite['skipped'] . '"' . ' time="' . round($duration, 6) . '"' . ' timestamp="' . $this->testsuite['timestamp'] . '">' . PHP_EOL;
foreach ($this->testsuite['testcase'] as $testcase) {
$junitxml .= "\t" . '<testcase' . ' name="' . $testcase['name'] . '"' . ' assertions="' . $testcase['assertions'] . '"' . ' classname="' . $testcase['classname'] . '"' . ' status="' . $testcase['status'] . '"' . ' time="' . round($testcase['time'], 6) . '">' . PHP_EOL;
if ($testcase['skipped']) {
$junitxml .= "\t\t" . '<skipped/>' . PHP_EOL;
}
if ($testcase['failure']) {
$junitxml .= "\t\t" . '<failure/>' . PHP_EOL;
}
if ($testcase['error']) {
$junitxml .= "\t\t" . '<error/>' . PHP_EOL;
}
$junitxml .= "\t" . '</testcase>' . PHP_EOL;
}
$junitxml .= '</testsuite>' . PHP_EOL;
file_put_contents($this->filename, $junitxml);
}