99% of 159OPs |
100% of 21Lines |
82% of 17Branches |
78% of 9Paths |
| Method | OPs | OPs % | Lines | Line % | Branches | Branches % | Paths | Path % |
|---|---|---|---|---|---|---|---|---|
| mageekguy\atoum\asserters\stream::setWith() | 21 | 100% | 3 | 100% | 1 | 100% | 1 | 100% |
| mageekguy\atoum\asserters\stream::getStreamController() | 6 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
| mageekguy\atoum\asserters\stream::isRead() | 51 | 100% | 6 | 100% | 5 | 80% | 2 | 50% |
| mageekguy\atoum\asserters\stream::isWrited() | 11 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
| mageekguy\atoum\asserters\stream::isWritten() | 51 | 100% | 6 | 100% | 5 | 80% | 2 | 50% |
| mageekguy\atoum\asserters\stream::streamIsSet() | 19 | 95% | 4 | 100% | 4 | 75% | 2 | 100% |
| # | |
|---|---|
| 1 |
<?php |
| 2 |
|
| 3 |
namespace mageekguy\atoum\asserters; |
| 4 |
|
| 5 |
use |
| 6 |
mageekguy\atoum, |
| 7 |
mageekguy\atoum\test, |
| 8 |
mageekguy\atoum\exceptions |
| 9 |
; |
| 10 |
|
| 11 |
class stream extends atoum\asserter |
| 12 |
{
|
| 13 |
protected $streamController = null; |
| 14 |
|
| 15 |
public function setWith($stream)100% |
| 16 |
{
|
| 17 |
parent::setWith($stream); |
| 18 |
|
| 19 |
$this->streamController = atoum\mock\stream::get($stream); |
| 20 |
|
| 21 |
return $this; |
| 22 |
} |
| 23 |
|
| 24 |
public function getStreamController()100% |
| 25 |
{
|
| 26 |
return $this->streamController; |
| 27 |
} |
| 28 |
|
| 29 |
public function isRead($failMessage = null)100% |
| 30 |
{
|
| 31 |
if (sizeof($this->streamIsSet()->streamController->getCalls(new test\adapter\call('stream_read'))) > 0)
|
| 32 |
{
|
| 33 |
$this->pass(); |
| 34 |
} |
| 35 |
else |
| 36 |
{
|
| 37 |
$this->fail($failMessage ?: $this->_('stream %s is not read', $this->streamController));
|
| 38 |
} |
| 39 |
|
| 40 |
return $this; |
| 41 |
} |
| 42 |
|
| 43 |
public function isWrited($failMessage = null)100% |
| 44 |
{
|
| 45 |
return $this->isWritten($failMessage); |
| 46 |
} |
| 47 |
|
| 48 |
public function isWritten($failMessage = null)100% |
| 49 |
{
|
| 50 |
if (sizeof($this->streamIsSet()->streamController->getCalls(new test\adapter\call('stream_write'))) > 0)
|
| 51 |
{
|
| 52 |
$this->pass(); |
| 53 |
} |
| 54 |
else |
| 55 |
{
|
| 56 |
$this->fail($failMessage ?: $this->_('stream %s is not written', $this->streamController));
|
| 57 |
} |
| 58 |
|
| 59 |
return $this; |
| 60 |
} |
| 61 |
|
| 62 |
protected function streamIsSet()100% |
| 63 |
{
|
| 64 |
if ($this->streamController === null) |
| 65 |
{
|
| 66 |
throw new exceptions\logic('Stream is undefined');
|
| 67 |
} |
| 68 |
|
| 69 |
return $this; |
| 70 |
} |
| 71 |
} |