1 | <?php |
||
22 | class DataValueDeserializerTest extends PHPUnit_Framework_TestCase { |
||
23 | |||
24 | public function testGivenEmptyArray_isDeserializerForReturnsFalse() { |
||
25 | $deserializer = $this->newDeserializer(); |
||
26 | $this->assertFalse( $deserializer->isDeserializerFor( array() ) ); |
||
27 | } |
||
28 | |||
29 | private function newDeserializer() { |
||
38 | |||
39 | /** |
||
40 | * @dataProvider notAnArrayProvider |
||
41 | */ |
||
42 | public function testGivenNonArray_isDeserializerForReturnsFalse( $notAnArray ) { |
||
46 | |||
47 | public function notAnArrayProvider() { |
||
56 | |||
57 | /** |
||
58 | * @dataProvider notADataValuesListProvider |
||
59 | */ |
||
60 | public function testGivenNonDataValues_constructorThrowsException( array $invalidDVList ) { |
||
65 | |||
66 | public function notADataValuesListProvider() { |
||
96 | |||
97 | public function testGivenSerializationNoType_deserializeThrowsException() { |
||
103 | |||
104 | public function testGivenSerializationWithUnknownType_deserializeThrowsException() { |
||
105 | $deserializer = $this->newDeserializer(); |
||
106 | |||
107 | $this->setExpectedException( UnsupportedTypeException::class ); |
||
108 | $deserializer->deserialize( |
||
109 | array( |
||
110 | 'value' => null, |
||
111 | 'type' => 'ohi' |
||
112 | ) |
||
113 | ); |
||
114 | } |
||
115 | |||
116 | public function testGivenSerializationWithNoValue_deserializeThrowsException() { |
||
126 | |||
127 | /** |
||
128 | * @dataProvider invalidDataValueSerializationProvider |
||
129 | */ |
||
130 | public function testGivenInvalidDataValue_deserializeThrowsException( $invalidSerialization ) { |
||
136 | |||
137 | public function invalidDataValueSerializationProvider() { |
||
148 | |||
149 | public function testInvalidValueSerialization_throwsDeserializationException() { |
||
160 | |||
161 | /** |
||
162 | * @dataProvider dataValueSerializationProvider |
||
163 | */ |
||
164 | public function testGivenDataValueSerialization_isDeserializerForReturnsTrue( $dvSerialization ) { |
||
168 | |||
169 | public function dataValueSerializationProvider() { |
||
180 | |||
181 | /** |
||
182 | * @dataProvider dataValueSerializationProvider |
||
183 | */ |
||
184 | public function testGivenDataValueSerialization_deserializeReturnsDataValue( $dvSerialization, $expectedType ) { |
||
192 | |||
193 | } |
||
194 |