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.
13
* @package CodeCoverage
14
* @author Arne Blankerts <arne@blankerts.de>
15
* @copyright Sebastian Bergmann <sebastian@phpunit.de>
16
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
17
* @link http://github.com/sebastianbergmann/php-code-coverage
18
* @since Class available since Release 2.0.0
20
class PHP_CodeCoverage_Report_XML_Tests
24
private $codeMap = array(
25
0 => 'PASSED', // PHPUnit_Runner_BaseTestRunner::STATUS_PASSED
26
1 => 'SKIPPED', // PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED
27
2 => 'INCOMPLETE', // PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE
28
3 => 'FAILURE', // PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE
29
4 => 'ERROR', // PHPUnit_Runner_BaseTestRunner::STATUS_ERROR
30
5 => 'RISKY' // PHPUnit_Runner_BaseTestRunner::STATUS_RISKY
33
public function __construct(DOMElement $context)
35
$this->contextNode = $context;
38
public function addTest($test, $result)
40
$node = $this->contextNode->appendChild(
41
$this->contextNode->ownerDocument->createElementNS(
42
'http://schema.phpunit.de/coverage/1.0', 'test'
45
$node->setAttribute('name', $test);
46
$node->setAttribute('result', (int) $result);
47
$node->setAttribute('status', $this->codeMap[(int) $result]);