3 * This file is part of the PHP_CodeCoverage package.
5 * (c) Sebastian Bergmann <sebastian@phpunit.de>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
12 * @since Class available since Release 2.0.0
14 class PHP_CodeCoverage_Report_XML_Tests
18 private $codeMap = array(
19 0 => 'PASSED', // PHPUnit_Runner_BaseTestRunner::STATUS_PASSED
20 1 => 'SKIPPED', // PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED
21 2 => 'INCOMPLETE', // PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE
22 3 => 'FAILURE', // PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE
23 4 => 'ERROR', // PHPUnit_Runner_BaseTestRunner::STATUS_ERROR
24 5 => 'RISKY' // PHPUnit_Runner_BaseTestRunner::STATUS_RISKY
27 public function __construct(DOMElement $context)
29 $this->contextNode = $context;
32 public function addTest($test, array $result)
34 $node = $this->contextNode->appendChild(
35 $this->contextNode->ownerDocument->createElementNS(
36 'http://schema.phpunit.de/coverage/1.0',
40 $node->setAttribute('name', $test);
41 $node->setAttribute('size', $result['size']);
42 $node->setAttribute('result', (int) $result['status']);
43 $node->setAttribute('status', $this->codeMap[(int) $result['status']]);