| Total Complexity | 4 |
| Total Lines | 57 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class MockFilterQuery |
||
| 11 | { |
||
| 12 | private $results; |
||
| 13 | |||
| 14 | 6 | public function __construct(Builder $query) |
|
| 15 | { |
||
| 16 | 6 | $this->results = $query->get(); |
|
| 17 | 6 | } |
|
| 18 | |||
| 19 | /** |
||
| 20 | * Assert that the query builder will return the given model. |
||
| 21 | * |
||
| 22 | * @param Model $element The model contained in the query result |
||
| 23 | * @param string $message |
||
| 24 | * @return $this |
||
| 25 | */ |
||
| 26 | 2 | public function assertContains(Model $element, string $message = ''): self |
|
| 27 | { |
||
| 28 | 2 | PHPUnit::assertThat( |
|
| 29 | 2 | $this->results, |
|
| 30 | 2 | new EloquentCollectionContains($element), |
|
| 31 | 2 | $message |
|
| 32 | ); |
||
| 33 | |||
| 34 | 1 | return $this; |
|
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Assert that the query builder will not return the given model. |
||
| 39 | * |
||
| 40 | * @param Model $element The model not contained in the query result |
||
| 41 | * @param string $message |
||
| 42 | * @return $this |
||
| 43 | */ |
||
| 44 | 2 | public function assertMissing(Model $element, string $message = ''): self |
|
| 45 | { |
||
| 46 | 2 | PHPUnit::assertThat( |
|
| 47 | 2 | $this->results, |
|
| 48 | 2 | PHPUnit::logicalNot(new EloquentCollectionContains($element)), |
|
| 49 | 2 | $message |
|
| 50 | ); |
||
| 51 | |||
| 52 | 1 | return $this; |
|
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * Assert that the query builder returns the given number of records. |
||
| 57 | * |
||
| 58 | * @param int $count |
||
| 59 | * @param string $message |
||
| 60 | * @return $this |
||
| 61 | */ |
||
| 62 | 1 | public function assertCount(int $count, string $message = ''): self |
|
| 67 | } |
||
| 68 | } |
||
| 69 |