mageekguy\atoum\report\fields\runner\failures\execute: lines coverage

72% of 145

OPs

100% of 27

Lines

68% of 25

Branches

33% of 21

Paths
Method OPs OPs % Lines Line % Branches Branches % Paths Path %
mageekguy\atoum\report\fields\runner\failures\execute::__construct() 20 100% 5 100% 1 0% 1 100%
mageekguy\atoum\report\fields\runner\failures\execute::__toString() 87 54% 16 100% 20 65% 16 13%
mageekguy\atoum\report\fields\runner\failures\execute::setCommand() 10 100% 2 100% 1 100% 1 100%
mageekguy\atoum\report\fields\runner\failures\execute::getCommand() 6 100% 1 100% 1 100% 1 100%
mageekguy\atoum\report\fields\runner\failures\execute::setAdapter() 16 100% 2 100% 1 100% 1 100%
mageekguy\atoum\report\fields\runner\failures\execute::getAdapter() 6 100% 1 100% 1 100% 1 100%
#
1
<?php
2

                    
3
namespace mageekguy\atoum\report\fields\runner\failures;
4

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

                    
14
class execute extends runner\failures
15
{
16
	protected $command = '';
17
	protected $adapter;
18

                    
19
	public function __construct($command)100%
20
	{
21
		parent::__construct();
22

                    
23
		$this
24
			->setCommand($command)
25
			->setAdapter()
26
		;
27
	}
28

                    
29
	public function __toString()100%
30
	{
31
		if ($this->runner !== null)
32
		{
33
			$fails = array();
34

                    
35
			foreach ($this->runner->getScore()->getFailAssertions() as $fail)
36
			{
37
				switch (true)
38
				{
39
					case isset($fails[$fail['file']]) === false:
40
					case $fails[$fail['file']] > $fail['line']:
41
						$fails[$fail['file']] = $fail['line'];
42
				}
43
			}
44

                    
45
			ksort($fails);
46

                    
47
			foreach ($fails as $file => $line)
48
			{
49
				$this->adapter->system(sprintf($this->getCommand(), $file, $line));
50
			}
51
		}
52

                    
53
		return '';
54
	}
55

                    
56
	public function setCommand($command)100%
57
	{
58
		$this->command = (string) $command;
59

                    
60
		return $this;
61
	}
62

                    
63
	public function getCommand()100%
64
	{
65
		return $this->command;
66
	}
67

                    
68
	public function setAdapter(adapter $adapter = null)100%
69
	{
70
		$this->adapter = $adapter ?: new adapter();
71

                    
72
		return $this;
73
	}
74

                    
75
	public function getAdapter()100%
76
	{
77
		return $this->adapter;
78
	}
79
}