| @@ 58-69 (lines=12) @@ | ||
| 55 | $this->getFilter($qb, 'a'); |
|
| 56 | } |
|
| 57 | ||
| 58 | public function it_filter_array_collection(): void |
|
| 59 | { |
|
| 60 | $this->beConstructedWith('points', [1230, 2500], null); |
|
| 61 | ||
| 62 | $players = [ |
|
| 63 | ['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500], |
|
| 64 | ['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230], |
|
| 65 | ['pseudo' => 'Alice', 'gender' => 'F', 'points' => 9001], |
|
| 66 | ]; |
|
| 67 | ||
| 68 | $this->filterCollection($players)->shouldYield([$players[0], $players[1]]); |
|
| 69 | } |
|
| 70 | ||
| 71 | public function it_filter_object_collection(): void |
|
| 72 | { |
|
| @@ 65-76 (lines=12) @@ | ||
| 62 | $this->getFilter($qb, 'x')->shouldReturn('x.age <= :comparison_10'); |
|
| 63 | } |
|
| 64 | ||
| 65 | public function it_filter_array_collection(): void |
|
| 66 | { |
|
| 67 | $this->beConstructedWith('points', 2500, null); |
|
| 68 | ||
| 69 | $players = [ |
|
| 70 | ['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500], |
|
| 71 | ['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230], |
|
| 72 | ['pseudo' => 'Alice', 'gender' => 'F', 'points' => 9001], |
|
| 73 | ]; |
|
| 74 | ||
| 75 | $this->filterCollection($players)->shouldYield([$players[0], $players[1]]); |
|
| 76 | } |
|
| 77 | ||
| 78 | public function it_filter_object_collection(): void |
|
| 79 | { |
|
| @@ 91-102 (lines=12) @@ | ||
| 88 | $this->filterCollection($players)->shouldYield([$players[1]]); |
|
| 89 | } |
|
| 90 | ||
| 91 | public function it_filter_array_collection_ends_with(): void |
|
| 92 | { |
|
| 93 | $this->beConstructedWith('pseudo', 'oe', Like::ENDS_WITH, null); |
|
| 94 | ||
| 95 | $players = [ |
|
| 96 | ['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500], |
|
| 97 | ['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230], |
|
| 98 | ['pseudo' => 'Alice', 'gender' => 'F', 'points' => 9001], |
|
| 99 | ]; |
|
| 100 | ||
| 101 | $this->filterCollection($players)->shouldYield([$players[0], $players[1]]); |
|
| 102 | } |
|
| 103 | ||
| 104 | public function it_filter_array_collection_contains(): void |
|
| 105 | { |
|
| @@ 104-115 (lines=12) @@ | ||
| 101 | $this->filterCollection($players)->shouldYield([$players[0], $players[1]]); |
|
| 102 | } |
|
| 103 | ||
| 104 | public function it_filter_array_collection_contains(): void |
|
| 105 | { |
|
| 106 | $this->beConstructedWith('pseudo', 'o', Like::CONTAINS, null); |
|
| 107 | ||
| 108 | $players = [ |
|
| 109 | ['pseudo' => 'Joe', 'gender' => 'M', 'points' => 2500], |
|
| 110 | ['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230], |
|
| 111 | ['pseudo' => 'Alice', 'gender' => 'F', 'points' => 9001], |
|
| 112 | ]; |
|
| 113 | ||
| 114 | $this->filterCollection($players)->shouldYield([$players[0], $players[1]]); |
|
| 115 | } |
|
| 116 | ||
| 117 | public function it_filter_object_collection_starts_with(): void |
|
| 118 | { |
|