| Total Complexity | 1 |
| Total Lines | 22 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | class EachTest extends TestCase |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @test |
||
| 19 | */ |
||
| 20 | public function validateValues(): void |
||
| 21 | { |
||
| 22 | $values = [ |
||
| 23 | 10, 20, 30 |
||
| 24 | ]; |
||
| 25 | |||
| 26 | $rules = new Rules([ |
||
| 27 | (new Number())->max(13) |
||
| 28 | ]); |
||
| 29 | |||
| 30 | $result = (new Each($rules))->validate($values); |
||
| 31 | $errors = $result->getErrors(); |
||
| 32 | |||
| 33 | $this->assertFalse($result->isValid()); |
||
| 34 | $this->assertCount(2, $errors); |
||
| 35 | $this->assertContains('Value must be no greater than 13. 20 given.', $errors); |
||
| 36 | $this->assertContains('Value must be no greater than 13. 30 given.', $errors); |
||
| 37 | } |
||
| 39 |