mageekguy\atoum\report\fields\runner\tests\coverage\phing: lines coverage

89% of 253

OPs

100% of 46

Lines

69% of 29

Branches

24% of 21

Paths
Method OPs OPs % Lines Line % Branches Branches % Paths Path %
mageekguy\atoum\report\fields\runner\tests\coverage\phing::__toString() 229 88% 41 100% 26 65% 18 11%
mageekguy\atoum\report\fields\runner\tests\coverage\phing::showMissingCodeCoverage() 9 100% 2 100% 1 100% 1 100%
mageekguy\atoum\report\fields\runner\tests\coverage\phing::hideMissingCodeCoverage() 9 100% 2 100% 1 100% 1 100%
mageekguy\atoum\report\fields\runner\tests\coverage\phing::missingCodeCoverageIsShowed() 6 100% 1 100% 1 100% 1 100%
#
1
<?php
2

                    
3
namespace mageekguy\atoum\report\fields\runner\tests\coverage;
4

                    
5
use
6
	mageekguy\atoum,
7
	mageekguy\atoum\locale,
8
	mageekguy\atoum\cli\prompt,
9
	mageekguy\atoum\cli\colorizer,
10
	mageekguy\atoum\report
11
;
12

                    
13
class phing extends report\fields\runner\tests\coverage\cli
14
{
15
	protected $showMissingCodeCoverage = true;
16

                    
17
	public function __toString()100%
18
	{
19
		$string = '';
20

                    
21
		if ($this->coverage !== null && sizeof($this->coverage) > 0)
22
		{
23
			$string .= $this->titlePrompt .
24
				sprintf(
25
					$this->locale->_('%s : %s'),
26
					$this->titleColorizer->colorize($this->locale->_('Code coverage value')),
27
					$this->coverageColorizer->colorize(sprintf('%3.2f%%', $this->coverage->getValue() * 100.0))
28
				) .
29
				PHP_EOL
30
			;
31

                    
32
			if ($this->showMissingCodeCoverage === true)
33
			{
34
				foreach ($this->coverage->getMethods() as $class => $methods)
35
				{
36
					$classCoverage = $this->coverage->getValueForClass($class);
37

                    
38
					if ($classCoverage < 1.0)
39
					{
40
						$string .= $this->classPrompt .
41
							sprintf(
42
								$this->locale->_('%s : %s'),
43
								$this->titleColorizer->colorize(sprintf($this->locale->_('Class %s'), $class)),
44
								$this->coverageColorizer->colorize(sprintf('%3.2f%%', $classCoverage * 100.0))
45
							) .
46
							PHP_EOL
47
						;
48

                    
49
						foreach (array_keys($methods) as $method)
50
						{
51
							$methodCoverage = $this->coverage->getValueForMethod($class, $method);
52

                    
53
							if ($methodCoverage < 1.0)
54
							{
55
								$string .= $this->methodPrompt .
56
									sprintf(
57
										$this->locale->_('%s : %s'),
58
										$this->titleColorizer->colorize(sprintf($this->locale->_('     ::%s()'), $method)),
59
										$this->coverageColorizer->colorize(sprintf('%3.2f%%', $methodCoverage * 100.0))
60
									) .
61
									PHP_EOL
62
								;
63
							}
64
						}
65
					}
66
				}
67
			}
68
		}
69

                    
70
		return $string;
71
	}
72

                    
73
	public function showMissingCodeCoverage()100%
74
	{
75
		$this->showMissingCodeCoverage = true;
76

                    
77
		return $this;
78
	}
79

                    
80
	public function hideMissingCodeCoverage()100%
81
	{
82
		$this->showMissingCodeCoverage = false;
83

                    
84
		return $this;
85
	}
86

                    
87
	public function missingCodeCoverageIsShowed()100%
88
	{
89
		return $this->showMissingCodeCoverage;
90
	}
91
}