/** * Output a report as xunit format (Jenkins-compatible) * * This should definitely use one of the xml-specific build/output methods, but really... life is too short * * @see FUnit::report() * @see FUnit::run() */ protected static function report_xunit(array $tests) { $counts = static::test_stats($tests); $xml = "<?xml version=\"1.0\"?>\n"; $xml .= "<testsuite tests=\"{$counts['total']}\">\n"; foreach ($tests as $name => $tdata) { $xml .= " <testcase classname=\"funit.{$name}\" name=\"{$name}\" time=\"0\">\n"; if (!$tdata['pass']) { $xml .= "<failure/>"; } $xml .= "</testcase>\n"; } $xml .= "</testsuite>\n"; FUnit::report_out($xml); }