1 | <?php |
||
23 | class DataValueDeserializerTest extends PHPUnit_Framework_TestCase { |
||
24 | |||
25 | public function testGivenEmptyArray_isDeserializerForReturnsFalse() { |
||
29 | |||
30 | private function newDeserializer() { |
||
39 | |||
40 | /** |
||
41 | * @dataProvider notAnArrayProvider |
||
42 | */ |
||
43 | public function testGivenNonArray_isDeserializerForReturnsFalse( $notAnArray ) { |
||
47 | |||
48 | public function notAnArrayProvider() { |
||
57 | |||
58 | /** |
||
59 | * @dataProvider notADataValuesListProvider |
||
60 | */ |
||
61 | public function testGivenNonDataValues_constructorThrowsException( array $invalidDVList ) { |
||
66 | |||
67 | public function notADataValuesListProvider() { |
||
68 | return [ |
||
69 | [ |
||
70 | [ |
||
71 | 'foo', |
||
72 | null, |
||
73 | [], |
||
74 | true, |
||
75 | 42, |
||
76 | ] |
||
77 | ], |
||
78 | [ |
||
79 | [ |
||
80 | 'string' => 'foo', |
||
81 | ] |
||
82 | ], |
||
83 | [ |
||
84 | [ |
||
85 | 'string' => StringValue::class, |
||
86 | 'number' => 42, |
||
87 | ] |
||
88 | ], |
||
89 | [ |
||
90 | [ |
||
91 | 'string' => StringValue::class, |
||
92 | 'object' => 'stdClass', |
||
93 | ] |
||
94 | ] |
||
95 | ]; |
||
96 | } |
||
97 | |||
98 | public function testGivenSerializationNoType_deserializeThrowsException() { |
||
104 | |||
105 | public function testGivenSerializationWithUnknownType_deserializeThrowsException() { |
||
111 | |||
112 | public function testGivenSerializationWithNoValue_deserializeThrowsException() { |
||
118 | |||
119 | /** |
||
120 | * @dataProvider invalidDataValueSerializationProvider |
||
121 | */ |
||
122 | public function testGivenInvalidDataValue_deserializeThrowsException( $invalidSerialization ) { |
||
128 | |||
129 | public function invalidDataValueSerializationProvider() { |
||
140 | |||
141 | public function testInvalidValueSerialization_throwsDeserializationException() { |
||
152 | |||
153 | /** |
||
154 | * @dataProvider dataValueSerializationProvider |
||
155 | */ |
||
156 | public function testGivenDataValueSerialization_isDeserializerForReturnsTrue( $dvSerialization ) { |
||
160 | |||
161 | public function dataValueSerializationProvider() { |
||
172 | |||
173 | /** |
||
174 | * @dataProvider dataValueSerializationProvider |
||
175 | */ |
||
176 | public function testGivenDataValueSerialization_deserializeReturnsDataValue( $dvSerialization, $expectedType ) { |
||
184 | |||
185 | } |
||
186 |