1 | <?php |
||
21 | class JsonFileParserTest extends TestCase { |
||
22 | use PHPUnit4And6Compat; |
||
23 | |||
24 | private const VALID_FILE_JSON = [ |
||
25 | 'such' => 'string', |
||
26 | 42 => 13.37, |
||
27 | 'array' => [ |
||
28 | '~[,,_,,]:3' |
||
29 | ] |
||
30 | ]; |
||
31 | |||
32 | private const VALID_PAGE_JSON = [ |
||
33 | 'foo' => 'bar', |
||
34 | 1 => 2.3, |
||
35 | 'array' => [ |
||
36 | '~[,,_,,]:3' |
||
37 | ] |
||
38 | ]; |
||
39 | |||
40 | private const EXISTING_GEO_JSON_PAGE = 'Such'; |
||
41 | private const EXISTING_GEO_JSON_PAGE_WITH_PREFIX = 'GeoJson:Such'; |
||
42 | private const NON_EXISTING_GEO_JSON_PAGE = 'GeoJson:Nope'; |
||
43 | |||
44 | /** |
||
45 | * @var FileFetcher |
||
46 | */ |
||
47 | private $fileFetcher; |
||
48 | |||
49 | public function setUp() { |
||
55 | |||
56 | private function newJsonFileParser(): JsonFileParser { |
||
62 | |||
63 | public function testWhenFileRetrievalFails_emptyJsonIsReturned() { |
||
71 | |||
72 | public function testWhenFileHasValidJson_jsonIsReturned() { |
||
80 | |||
81 | public function testWhenFileIsEmpty_emptyJsonIsReturned() { |
||
89 | |||
90 | public function testWhenFileLocationIsNotUrl_emptyJsonIsReturned() { |
||
98 | |||
99 | public function testWhenPageExists_itsContentsIsReturned() { |
||
105 | |||
106 | public function testWhenPageDoesNotExist_emptyJsonIsReturned() { |
||
112 | |||
113 | public function testWhenExistingPageIsSpecifiedWithoutPrefix_itsContentsIsReturned() { |
||
119 | |||
120 | } |
||
121 |