Total Complexity | 4 |
Total Lines | 27 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class JsonSerializerFunctionsTest extends TestCase |
||
9 | { |
||
10 | |||
11 | /** @dataProvider data */ |
||
12 | public function test_serialize_to_json($data) |
||
13 | { |
||
14 | $this->assertEquals(JsonSerializerTest::SERIALIZED_JSON, json_encode($data)); |
||
15 | } |
||
16 | |||
17 | public function test_unserialize_json() |
||
18 | { |
||
19 | $this->assertEquals( |
||
20 | json_decode(JsonSerializerTest::SERIALIZED_JSON, false), |
||
21 | json_unserialize(JsonSerializerTest::SERIALIZED_JSON) |
||
22 | ); |
||
23 | } |
||
24 | |||
25 | public function test_unserialize_error() |
||
26 | { |
||
27 | $this->assertSame('', json_unserialize(''), 'Returns empty string on JSON decoding fails'); |
||
28 | } |
||
29 | |||
30 | public function data() |
||
31 | { |
||
32 | return [ |
||
33 | [ |
||
34 | require __DIR__ . '/fixtures/config-test.php' |
||
35 | ] |
||
39 |