Chris@0
|
1 <?php
|
Chris@0
|
2 /*
|
Chris@0
|
3 * This file is part of the PHP_CodeCoverage package.
|
Chris@0
|
4 *
|
Chris@0
|
5 * (c) Sebastian Bergmann <sebastian@phpunit.de>
|
Chris@0
|
6 *
|
Chris@0
|
7 * For the full copyright and license information, please view the LICENSE
|
Chris@0
|
8 * file that was distributed with this source code.
|
Chris@0
|
9 */
|
Chris@0
|
10
|
Chris@0
|
11 /**
|
Chris@0
|
12 * @since Class available since Release 2.0.0
|
Chris@0
|
13 */
|
Chris@0
|
14 class PHP_CodeCoverage_Report_XML_Project extends PHP_CodeCoverage_Report_XML_Node
|
Chris@0
|
15 {
|
Chris@0
|
16 public function __construct($name)
|
Chris@0
|
17 {
|
Chris@0
|
18 $this->init();
|
Chris@0
|
19 $this->setProjectName($name);
|
Chris@0
|
20 }
|
Chris@0
|
21
|
Chris@0
|
22 private function init()
|
Chris@0
|
23 {
|
Chris@0
|
24 $dom = new DOMDocument;
|
Chris@0
|
25 $dom->loadXML('<?xml version="1.0" ?><phpunit xmlns="http://schema.phpunit.de/coverage/1.0"><project/></phpunit>');
|
Chris@0
|
26
|
Chris@0
|
27 $this->setContextNode(
|
Chris@0
|
28 $dom->getElementsByTagNameNS(
|
Chris@0
|
29 'http://schema.phpunit.de/coverage/1.0',
|
Chris@0
|
30 'project'
|
Chris@0
|
31 )->item(0)
|
Chris@0
|
32 );
|
Chris@0
|
33 }
|
Chris@0
|
34
|
Chris@0
|
35 private function setProjectName($name)
|
Chris@0
|
36 {
|
Chris@0
|
37 $this->getContextNode()->setAttribute('name', $name);
|
Chris@0
|
38 }
|
Chris@0
|
39
|
Chris@0
|
40 public function getTests()
|
Chris@0
|
41 {
|
Chris@0
|
42 $testsNode = $this->getContextNode()->getElementsByTagNameNS(
|
Chris@0
|
43 'http://schema.phpunit.de/coverage/1.0',
|
Chris@0
|
44 'tests'
|
Chris@0
|
45 )->item(0);
|
Chris@0
|
46
|
Chris@0
|
47 if (!$testsNode) {
|
Chris@0
|
48 $testsNode = $this->getContextNode()->appendChild(
|
Chris@0
|
49 $this->getDom()->createElementNS(
|
Chris@0
|
50 'http://schema.phpunit.de/coverage/1.0',
|
Chris@0
|
51 'tests'
|
Chris@0
|
52 )
|
Chris@0
|
53 );
|
Chris@0
|
54 }
|
Chris@0
|
55
|
Chris@0
|
56 return new PHP_CodeCoverage_Report_XML_Tests($testsNode);
|
Chris@0
|
57 }
|
Chris@0
|
58
|
Chris@0
|
59 public function asDom()
|
Chris@0
|
60 {
|
Chris@0
|
61 return $this->getDom();
|
Chris@0
|
62 }
|
Chris@0
|
63 }
|