Total Complexity | 5 |
Total Lines | 57 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
14 | final class ValueValidatorTest extends TestCase |
||
15 | { |
||
16 | /** @var ValueValidator */ |
||
17 | private $validator; |
||
18 | |||
19 | protected function setUp() : void |
||
20 | { |
||
21 | $this->validator = new ValueValidator(); |
||
22 | } |
||
23 | |||
24 | /** |
||
25 | * @param mixed $value |
||
26 | * |
||
27 | * @dataProvider validTypeValidationProvider |
||
28 | */ |
||
29 | public function testValidatesValuesMatchingType(Type $type, $value) : void |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * @return mixed[] |
||
40 | */ |
||
41 | public function validTypeValidationProvider() : iterable |
||
42 | { |
||
43 | yield 'valid string' => [ |
||
|
|||
44 | new StringType(), |
||
45 | 'foo', |
||
46 | ]; |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * @param mixed $value |
||
51 | * |
||
52 | * @dataProvider invalidTypeValidationProvider |
||
53 | */ |
||
54 | public function testNotValidatesValuesNotMatchingTypeAndThrows(Type $type, $value) : void |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * @return mixed[] |
||
65 | */ |
||
66 | public function invalidTypeValidationProvider() : iterable |
||
74 |