83% of 261OPs |
100% of 42Lines |
83% of 23Branches |
81% of 16Paths |
# | |
---|---|
1 |
<?php |
2 |
|
3 |
namespace mageekguy\atoum\report\fields\runner\tests\skipped; |
4 |
|
5 |
use |
6 |
mageekguy\atoum\cli\prompt, |
7 |
mageekguy\atoum\cli\colorizer, |
8 |
mageekguy\atoum\report\fields\runner\tests\skipped |
9 |
; |
10 |
|
11 |
class cli extends skipped |
12 |
{ |
13 |
protected $titlePrompt = null; |
14 |
protected $titleColorizer = null; |
15 |
protected $methodPrompt = null; |
16 |
protected $methodColorizer = null; |
17 |
protected $messagePrompt = null; |
18 |
protected $messageColorizer = null; |
19 |
|
20 |
public function __construct()100% |
21 |
{ |
22 |
parent::__construct(); |
23 |
|
24 |
$this |
25 |
->setTitlePrompt() |
26 |
->setTitleColorizer() |
27 |
->setMethodPrompt() |
28 |
->setMethodColorizer() |
29 |
->setMessageColorizer() |
30 |
; |
31 |
} |
32 |
|
33 |
public function __toString()100% |
34 |
{ |
35 |
$string = ''; |
36 |
|
37 |
if ($this->runner !== null) |
38 |
{ |
39 |
$skippedMethods = $this->runner->getScore()->getSkippedMethods(); |
40 |
|
41 |
$sizeOfSkippedMethod = sizeof($skippedMethods); |
42 |
|
43 |
if ($sizeOfSkippedMethod > 0) |
44 |
{ |
45 |
$string .= |
46 |
$this->titlePrompt . |
47 |
sprintf( |
48 |
$this->locale->_('%s:'), |
49 |
$this->titleColorizer->colorize(sprintf($this->locale->__('There is %d skipped method', 'There are %d skipped methods', $sizeOfSkippedMethod), $sizeOfSkippedMethod)) |
50 |
) . |
51 |
PHP_EOL |
52 |
; |
53 |
|
54 |
foreach ($skippedMethods as $skippedMethod) |
55 |
{ |
56 |
$string .= $this->methodPrompt . sprintf($this->locale->_('%s: %s'), $this->methodColorizer->colorize(sprintf('%s::%s()', $skippedMethod['class'], $skippedMethod['method'])), $this->messageColorizer->colorize($skippedMethod['message'])) . PHP_EOL; |
57 |
} |
58 |
} |
59 |
} |
60 |
|
61 |
return $string; |
62 |
} |
63 |
|
64 |
public function setTitlePrompt(prompt $prompt = null)100% |
65 |
{ |
66 |
$this->titlePrompt = $prompt ?: new prompt(); |
67 |
|
68 |
return $this; |
69 |
} |
70 |
|
71 |
public function getTitlePrompt()100% |
72 |
{ |
73 |
return $this->titlePrompt; |
74 |
} |
75 |
|
76 |
public function setTitleColorizer(colorizer $colorizer = null)100% |
77 |
{ |
78 |
$this->titleColorizer = $colorizer ?: new colorizer(); |
79 |
|
80 |
return $this; |
81 |
} |
82 |
|
83 |
public function getTitleColorizer()100% |
84 |
{ |
85 |
return $this->titleColorizer; |
86 |
} |
87 |
|
88 |
public function setMethodPrompt(prompt $prompt = null)100% |
89 |
{ |
90 |
$this->methodPrompt = $prompt ?: new prompt(); |
91 |
|
92 |
return $this; |
93 |
} |
94 |
|
95 |
public function getMethodPrompt()100% |
96 |
{ |
97 |
return $this->methodPrompt; |
98 |
} |
99 |
|
100 |
public function setMethodColorizer(colorizer $colorizer = null)100% |
101 |
{ |
102 |
$this->methodColorizer = $colorizer ?: new colorizer(); |
103 |
|
104 |
return $this; |
105 |
} |
106 |
|
107 |
public function getMethodColorizer()100% |
108 |
{ |
109 |
return $this->methodColorizer; |
110 |
} |
111 |
|
112 |
public function setMessageColorizer(colorizer $colorizer = null)100% |
113 |
{ |
114 |
$this->messageColorizer = $colorizer ?: new colorizer(); |
115 |
|
116 |
return $this; |
117 |
} |
118 |
|
119 |
public function getMessageColorizer()100% |
120 |
{ |
121 |
return $this->messageColorizer; |
122 |
} |
123 |
} |