100% of 163OPs |
100% of 22Lines |
92% of 12Branches |
100% of 9Paths |
| Method | OPs | OPs % | Lines | Line % | Branches | Branches % | Paths | Path % |
|---|---|---|---|---|---|---|---|---|
| mageekguy\atoum\report\fields\runner\tests\memory\cli::__construct() | 22 | 100% | 6 | 100% | 1 | 0% | 1 | 100% |
| mageekguy\atoum\report\fields\runner\tests\memory\cli::__toString() | 75 | 100% | 7 | 100% | 5 | 100% | 2 | 100% |
| mageekguy\atoum\report\fields\runner\tests\memory\cli::setPrompt() | 16 | 100% | 2 | 100% | 1 | 100% | 1 | 100% |
| mageekguy\atoum\report\fields\runner\tests\memory\cli::getPrompt() | 6 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
| mageekguy\atoum\report\fields\runner\tests\memory\cli::setTitleColorizer() | 16 | 100% | 2 | 100% | 1 | 100% | 1 | 100% |
| mageekguy\atoum\report\fields\runner\tests\memory\cli::getTitleColorizer() | 6 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
| mageekguy\atoum\report\fields\runner\tests\memory\cli::setMemoryColorizer() | 16 | 100% | 2 | 100% | 1 | 100% | 1 | 100% |
| mageekguy\atoum\report\fields\runner\tests\memory\cli::getMemoryColorizer() | 6 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
| # | |
|---|---|
| 1 |
<?php |
| 2 |
|
| 3 |
namespace mageekguy\atoum\report\fields\runner\tests\memory; |
| 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 cli extends report\fields\runner\tests\memory |
| 14 |
{
|
| 15 |
protected $prompt = null; |
| 16 |
protected $memoryColorizer = null; |
| 17 |
protected $titleColorizer = null; |
| 18 |
|
| 19 |
public function __construct()100% |
| 20 |
{
|
| 21 |
parent::__construct(); |
| 22 |
|
| 23 |
$this |
| 24 |
->setPrompt() |
| 25 |
->setTitleColorizer() |
| 26 |
->setMemoryColorizer() |
| 27 |
; |
| 28 |
} |
| 29 |
|
| 30 |
public function __toString()100% |
| 31 |
{
|
| 32 |
$title = $this->locale->__('Total test memory usage', 'Total tests memory usage', $this->testNumber);
|
| 33 |
|
| 34 |
if ($this->value === null) |
| 35 |
{
|
| 36 |
$memory = $this->locale->_('unknown');
|
| 37 |
} |
| 38 |
else |
| 39 |
{
|
| 40 |
$memory = sprintf($this->locale->_('%4.2f Mb'), $this->value / 1048576);
|
| 41 |
} |
| 42 |
|
| 43 |
return $this->prompt . sprintf($this->locale->_('%s: %s.'), $this->titleColorizer->colorize($title), $this->memoryColorizer->colorize($memory)) . PHP_EOL;
|
| 44 |
} |
| 45 |
|
| 46 |
public function setPrompt(prompt $prompt = null)100% |
| 47 |
{
|
| 48 |
$this->prompt = $prompt ?: new prompt(); |
| 49 |
|
| 50 |
return $this; |
| 51 |
} |
| 52 |
|
| 53 |
public function getPrompt()100% |
| 54 |
{
|
| 55 |
return $this->prompt; |
| 56 |
} |
| 57 |
|
| 58 |
public function setTitleColorizer(colorizer $colorizer = null)100% |
| 59 |
{
|
| 60 |
$this->titleColorizer = $colorizer ?: new colorizer(); |
| 61 |
|
| 62 |
return $this; |
| 63 |
} |
| 64 |
|
| 65 |
public function getTitleColorizer()100% |
| 66 |
{
|
| 67 |
return $this->titleColorizer; |
| 68 |
} |
| 69 |
|
| 70 |
public function setMemoryColorizer(colorizer $colorizer = null)100% |
| 71 |
{
|
| 72 |
$this->memoryColorizer = $colorizer ?: new colorizer(); |
| 73 |
|
| 74 |
return $this; |
| 75 |
} |
| 76 |
|
| 77 |
public function getMemoryColorizer()100% |
| 78 |
{
|
| 79 |
return $this->memoryColorizer; |
| 80 |
} |
| 81 |
} |