89% of 189OPs |
93% of 43Lines |
86% of 37Branches |
86% of 14Paths |
| Method | OPs | OPs % | Lines | Line % | Branches | Branches % | Paths | Path % |
|---|---|---|---|---|---|---|---|---|
| mageekguy\atoum\report\fields\runner\event\cli::__construct() | 20 | 100% | 3 | 100% | 1 | 0% | 1 | 100% |
| mageekguy\atoum\report\fields\runner\event\cli::__toString() | 163 | 87% | 39 | 92% | 35 | 89% | 12 | 83% |
| mageekguy\atoum\report\fields\runner\event\cli::getProgressBar() | 6 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
| # | |
|---|---|
| 1 |
<?php |
| 2 |
|
| 3 |
namespace mageekguy\atoum\report\fields\runner\event; |
| 4 |
|
| 5 |
use |
| 6 |
mageekguy\atoum\test, |
| 7 |
mageekguy\atoum\runner, |
| 8 |
mageekguy\atoum\report, |
| 9 |
mageekguy\atoum\exceptions, |
| 10 |
mageekguy\atoum\cli\progressBar |
| 11 |
; |
| 12 |
|
| 13 |
class cli extends report\fields\runner\event |
| 14 |
{
|
| 15 |
protected $progressBar = null; |
| 16 |
|
| 17 |
public function __construct(progressBar $progressBar = null)100% |
| 18 |
{
|
| 19 |
parent::__construct(); |
| 20 |
|
| 21 |
$this->progressBar = $progressBar ?: new progressBar(); |
| 22 |
} |
| 23 |
|
| 24 |
public function __toString()92% |
| 25 |
{
|
| 26 |
$string = ''; |
| 27 |
|
| 28 |
if ($this->observable !== null) |
| 29 |
{
|
| 30 |
if ($this->event === runner::runStop) |
| 31 |
{
|
| 32 |
$string = PHP_EOL; |
| 33 |
} |
| 34 |
else |
| 35 |
{
|
| 36 |
switch ($this->event) |
| 37 |
{
|
| 38 |
case runner::runStart: |
| 39 |
$this->progressBar->reset()->setIterations($this->observable->getTestMethodNumber()); |
| 40 |
break; |
| 41 |
|
| 42 |
case test::success: |
| 43 |
$this->progressBar->refresh('S');
|
| 44 |
break; |
| 45 |
|
| 46 |
case test::fail: |
| 47 |
$this->progressBar->refresh('F');
|
| 48 |
break; |
| 49 |
|
| 50 |
case test::void: |
| 51 |
$this->progressBar->refresh('0');
|
| 52 |
break; |
| 53 |
|
| 54 |
case test::error: |
| 55 |
$this->progressBar->refresh('E');
|
| 56 |
break; |
| 57 |
|
| 58 |
case test::exception: |
| 59 |
$this->progressBar->refresh('X');
|
| 60 |
break; |
| 61 |
|
| 62 |
case test::uncompleted: |
| 63 |
$this->progressBar->refresh('U');
|
| 64 |
break; |
| 65 |
|
| 66 |
case test::skipped: |
| 67 |
$this->progressBar->refresh('-');
|
| 68 |
break; |
| 69 |
|
| 70 |
case runner::runStop: |
| 71 |
$this->progressBar->reset(); |
| 72 |
break; |
| 73 |
} |
| 74 |
|
| 75 |
$string = (string) $this->progressBar; |
| 76 |
} |
| 77 |
} |
| 78 |
|
| 79 |
return $string; |
| 80 |
} |
| 81 |
|
| 82 |
public function getProgressBar()100% |
| 83 |
{
|
| 84 |
return $this->progressBar; |
| 85 |
} |
| 86 |
} |