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