Total Complexity | 5 |
Total Lines | 59 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
14 | final class MapTypeTest extends TypeTest |
||
15 | { |
||
16 | protected function createType() : Type |
||
17 | { |
||
18 | return new MapType($this->getKeyType(), $this->getValueType()); |
||
19 | } |
||
20 | |||
21 | public function testDescribe() : void |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * @return mixed[] |
||
28 | */ |
||
29 | public function validValidateValuesProvider() : iterable |
||
30 | { |
||
31 | yield [ |
||
|
|||
32 | ['foo' => 'bar'], |
||
33 | ['baz' => 42], |
||
34 | ['woof' => new stdClass()], |
||
35 | ['meow' => null], |
||
36 | [ |
||
37 | 'multiple' => 1, |
||
38 | 'items' => static function () : void { |
||
39 | }, |
||
40 | 'with' => new class () { |
||
41 | }, |
||
42 | 'different' => null, |
||
43 | 'types' => 'test', |
||
44 | ], |
||
45 | ]; |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * @return mixed[] |
||
50 | */ |
||
51 | public function invalidValidateValuesProvider() : iterable |
||
52 | { |
||
53 | yield [ |
||
54 | ['foo', 1], |
||
55 | [1 => 'bar'], |
||
56 | ['baz' => new stdClass(), 1 => 'zaz'], |
||
57 | ]; |
||
58 | } |
||
59 | |||
60 | public function testAcceptsNull() : void |
||
61 | { |
||
62 | self::assertSame($this->getValueType()->acceptsNull(), $this->getType()->acceptsNull()); |
||
63 | } |
||
64 | |||
65 | private function getKeyType() : ScalarType |
||
66 | { |
||
67 | return new StringType(); |
||
68 | } |
||
69 | |||
70 | private function getValueType() : Type |
||
73 | } |
||
74 | } |
||
75 |