| @@ 116-124 (lines=9) @@ | ||
| 113 | $this->isSatisfiedBy($player)->shouldBe(true); |
|
| 114 | } |
|
| 115 | ||
| 116 | public function it_is_satisfied_in_context_with_array(): void |
|
| 117 | { |
|
| 118 | $game = ['name' => 'Tetris']; |
|
| 119 | $player = ['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230, 'inGame' => $game]; |
|
| 120 | ||
| 121 | $this->beConstructedWith(Player::class, 'inGame'); |
|
| 122 | ||
| 123 | $this->isSatisfiedBy($player)->shouldBe(false); |
|
| 124 | } |
|
| 125 | ||
| 126 | public function it_is_satisfied_in_context_with_object(): void |
|
| 127 | { |
|
| @@ 121-130 (lines=10) @@ | ||
| 118 | $this->isSatisfiedBy($playerC)->shouldBe(true); |
|
| 119 | } |
|
| 120 | ||
| 121 | public function it_is_satisfied_in_context_with_array(): void |
|
| 122 | { |
|
| 123 | $releaseAt = new \DateTimeImmutable(); |
|
| 124 | $game = ['name' => 'Tetris', 'releaseAt' => $releaseAt]; |
|
| 125 | $player = ['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230, 'inGame' => $game]; |
|
| 126 | ||
| 127 | $this->beConstructedWith('releaseAt', 'inGame'); |
|
| 128 | ||
| 129 | $this->isSatisfiedBy($player)->shouldBe(true); |
|
| 130 | } |
|
| 131 | ||
| 132 | public function it_is_satisfied_in_context_with_object(): void |
|
| 133 | { |
|
| @@ 175-184 (lines=10) @@ | ||
| 172 | $this->filterCollection($players, 'inGame')->shouldYield([$players[2]]); |
|
| 173 | } |
|
| 174 | ||
| 175 | public function it_is_satisfied_in_global_context(): void |
|
| 176 | { |
|
| 177 | $releaseAt = new \DateTimeImmutable(); |
|
| 178 | $game = ['name' => 'Tetris', 'releaseAt' => $releaseAt]; |
|
| 179 | $player = ['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230, 'inGame' => $game]; |
|
| 180 | ||
| 181 | $this->beConstructedWith('releaseAt', null); |
|
| 182 | ||
| 183 | $this->isSatisfiedBy($player, 'inGame')->shouldBe(true); |
|
| 184 | } |
|
| 185 | ||
| 186 | public function it_filter_array_collection_in_combo_context(): void |
|
| 187 | { |
|
| @@ 276-284 (lines=9) @@ | ||
| 273 | $this->isSatisfiedBy($playerB)->shouldBe(false); |
|
| 274 | } |
|
| 275 | ||
| 276 | public function it_is_satisfied_in_context_with_array_contains(): void |
|
| 277 | { |
|
| 278 | $game = ['name' => 'Tetris']; |
|
| 279 | $player = ['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230, 'inGame' => $game]; |
|
| 280 | ||
| 281 | $this->beConstructedWith('name', 'tr', Like::CONTAINS, 'inGame'); |
|
| 282 | ||
| 283 | $this->isSatisfiedBy($player)->shouldBe(true); |
|
| 284 | } |
|
| 285 | ||
| 286 | public function it_is_satisfied_in_context_with_object_contains(): void |
|
| 287 | { |
|
| @@ 327-335 (lines=9) @@ | ||
| 324 | $this->filterCollection($players, 'inGame')->shouldYield([$players[2]]); |
|
| 325 | } |
|
| 326 | ||
| 327 | public function it_is_satisfied_in_global_context(): void |
|
| 328 | { |
|
| 329 | $game = ['name' => 'Tetris']; |
|
| 330 | $player = ['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230, 'inGame' => $game]; |
|
| 331 | ||
| 332 | $this->beConstructedWith('name', 'tr', Like::CONTAINS, null); |
|
| 333 | ||
| 334 | $this->isSatisfiedBy($player, 'inGame')->shouldBe(true); |
|
| 335 | } |
|
| 336 | ||
| 337 | public function it_filter_array_collection_in_combo_context(): void |
|
| 338 | { |
|
| @@ 182-190 (lines=9) @@ | ||
| 179 | $this->filterCollection([$player], 'inGame')->shouldYield([$player]); |
|
| 180 | } |
|
| 181 | ||
| 182 | public function it_is_satisfied_array_collection_in_context(): void |
|
| 183 | { |
|
| 184 | $this->beConstructedWith(new Equals('name', 'Mahjong')); |
|
| 185 | ||
| 186 | $game = ['name' => 'Tetris']; |
|
| 187 | $player = ['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230, 'inGame' => $game]; |
|
| 188 | ||
| 189 | $this->isSatisfiedBy($player, 'inGame')->shouldBe(true); |
|
| 190 | } |
|
| 191 | ||
| 192 | public function it_is_satisfied_object_collection_in_context(): void |
|
| 193 | { |
|
| @@ 167-175 (lines=9) @@ | ||
| 164 | $this->filterCollection($players, 'inGame')->shouldYield([$players[2]]); |
|
| 165 | } |
|
| 166 | ||
| 167 | public function it_is_satisfied_in_global_context(): void |
|
| 168 | { |
|
| 169 | $game = ['name' => 'Tetris', 'releaseAt' => null]; |
|
| 170 | $player = ['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230, 'inGame' => $game]; |
|
| 171 | ||
| 172 | $this->beConstructedWith('releaseAt', null); |
|
| 173 | ||
| 174 | $this->isSatisfiedBy($player, 'inGame')->shouldBe(true); |
|
| 175 | } |
|
| 176 | ||
| 177 | public function it_filter_array_collection_in_combo_context(): void |
|
| 178 | { |
|
| @@ 173-181 (lines=9) @@ | ||
| 170 | $this->filterCollection($players, 'inGame')->shouldYield([$players[2]]); |
|
| 171 | } |
|
| 172 | ||
| 173 | public function it_is_satisfied_in_global_context(): void |
|
| 174 | { |
|
| 175 | $game = ['name' => 'Tetris', 'releaseAt' => null]; |
|
| 176 | $player = ['pseudo' => 'Moe', 'gender' => 'M', 'points' => 1230, 'inGame' => $game]; |
|
| 177 | ||
| 178 | $this->beConstructedWith('releaseAt', null); |
|
| 179 | ||
| 180 | $this->isSatisfiedBy($player, 'inGame')->shouldBe(true); |
|
| 181 | } |
|
| 182 | ||
| 183 | public function it_filter_array_collection_in_combo_context(): void |
|
| 184 | { |
|