| Total Complexity | 13 |
| Total Lines | 71 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | class CheckExpectations |
||
| 6 | { |
||
| 7 | private $chain; |
||
| 8 | |||
| 9 | private $phpunit; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * CheckExpectations constructor. |
||
| 13 | * |
||
| 14 | * @param $chain |
||
| 15 | * @param $phpunit |
||
| 16 | */ |
||
| 17 | 39 | public function __construct(Chain $chain, $phpunit) |
|
| 21 | 39 | } |
|
| 22 | |||
| 23 | 39 | public function check() |
|
| 28 | 38 | } |
|
| 29 | |||
| 30 | 38 | private function checkResponse() |
|
| 31 | { |
||
| 32 | 38 | if (!$this->chain->http) { |
|
|
|
|||
| 33 | 1 | return; |
|
| 34 | } |
||
| 35 | 37 | $this->checkResponses($this->sendRequest()); |
|
| 36 | 37 | } |
|
| 37 | |||
| 38 | /** |
||
| 39 | * @return mixed |
||
| 40 | */ |
||
| 41 | 37 | private function sendRequest() |
|
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @param $response |
||
| 56 | */ |
||
| 57 | 37 | private function checkResponses($response) |
|
| 58 | { |
||
| 59 | 37 | foreach ($this->chain->assertion as $assertion) { |
|
| 60 | 29 | $type = $assertion['type']; |
|
| 61 | 29 | $response->$type($assertion['value']); |
|
| 62 | } |
||
| 63 | 37 | } |
|
| 64 | |||
| 65 | 39 | private function fireEvents() |
|
| 66 | { |
||
| 67 | 39 | if ($this->chain->event) { |
|
| 68 | 1 | event($this->chain->event); |
|
| 69 | } |
||
| 70 | 38 | } |
|
| 71 | |||
| 72 | 39 | private function expectExceptions() |
|
| 76 | } |
||
| 77 | 39 | } |
|
| 78 | } |
||
| 79 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.