Total Complexity | 5 |
Total Lines | 47 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
7 | class JsonDateAwareFormatterTest extends TestCase |
||
8 | { |
||
9 | /** |
||
10 | * @param mixed $data |
||
11 | * |
||
12 | * @return string |
||
13 | */ |
||
14 | public function encodeJson($data) |
||
15 | { |
||
16 | if (version_compare(PHP_VERSION, '5.4.0', '>=')) { |
||
17 | return json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); |
||
18 | } |
||
19 | |||
20 | return json_encode($data); |
||
21 | } |
||
22 | |||
23 | /** |
||
24 | * @return array |
||
25 | */ |
||
26 | public function dataFormat() |
||
27 | { |
||
28 | return [ |
||
29 | [['foo' => 'bar'], $this->encodeJson(['foo' => 'bar'])], |
||
30 | [['timestamp' => new \DateTime('@0')], $this->encodeJson(['timestamp' => '1970-01-01 00:00:00'])], |
||
31 | ]; |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @dataProvider dataFormat |
||
36 | * |
||
37 | * @param array $input |
||
38 | * @param string $expected |
||
39 | */ |
||
40 | public function testFormat(array $input, $expected) |
||
44 | } |
||
45 | |||
46 | public function testFormatBatch() |
||
54 | } |
||
55 | } |
||
56 |