16
16
class GeoJsonReaderTest extends GeoJsonAbstractTestCase
17
17
{
18
18
/**
19
- * @param string $geojson The GeoJSON to read.
19
+ * @param string $geoJson The GeoJSON to read.
20
20
* @param array $coords The expected Geometry coordinates.
21
21
* @param bool $is3D Whether the resulting Geometry has a Z coordinate.
22
22
* @param bool $lenient Whether to be lenient about case-sensitivity.
23
23
*/
24
24
#[DataProvider('providerReadGeometry ' )]
25
- public function testReadGeometry (string $ geojson , array $ coords , bool $ is3D , bool $ lenient ) : void
25
+ public function testReadGeometry (string $ geoJson , array $ coords , bool $ is3D , bool $ lenient ) : void
26
26
{
27
- $ geometry = (new GeoJsonReader ($ lenient ))->read ($ geojson );
27
+ $ geometry = (new GeoJsonReader ($ lenient ))->read ($ geoJson );
28
28
$ this ->assertGeometryContents ($ geometry , $ coords , $ is3D , false , 4326 );
29
29
}
30
30
31
31
public static function providerReadGeometry () : \Generator
32
32
{
33
- foreach (self ::providerGeometryGeoJson () as [$ geojson , $ coords , $ is3D ]) {
34
- yield [$ geojson , $ coords , $ is3D , false ];
35
- yield [self ::alterCase ($ geojson ), $ coords , $ is3D , true ];
33
+ foreach (self ::providerGeometryGeoJson () as [$ geoJson , $ coords , $ is3D ]) {
34
+ yield [$ geoJson , $ coords , $ is3D , false ];
35
+ yield [self ::alterCase ($ geoJson ), $ coords , $ is3D , true ];
36
36
}
37
37
}
38
38
39
39
/**
40
- * @param string $geojson The GeoJSON to read.
40
+ * @param string $geoJson The GeoJSON to read.
41
41
* @param stdClass|null $properties The contained properties.
42
42
* @param array|null $coords The expected Geometry coordinates, or null if the Feature has no geometry.
43
43
* @param bool $is3D Whether the resulting Geometry has a Z coordinate.
44
44
* @param bool $lenient Whether to be lenient about case-sensitivity.
45
45
*/
46
46
#[DataProvider('providerReadFeature ' )]
47
- public function testReadFeature (string $ geojson , ?stdClass $ properties , ?array $ coords , bool $ is3D , bool $ lenient ) : void
47
+ public function testReadFeature (string $ geoJson , ?stdClass $ properties , ?array $ coords , bool $ is3D , bool $ lenient ) : void
48
48
{
49
- $ feature = (new GeoJsonReader ($ lenient ))->read ($ geojson );
49
+ $ feature = (new GeoJsonReader ($ lenient ))->read ($ geoJson );
50
50
51
51
self ::assertInstanceOf (Feature::class, $ feature );
52
52
self ::assertEquals ($ properties , $ feature ->getProperties ());
@@ -62,22 +62,22 @@ public function testReadFeature(string $geojson, ?stdClass $properties, ?array $
62
62
63
63
public static function providerReadFeature () : \Generator
64
64
{
65
- foreach (self ::providerFeatureGeoJson () as [$ geojson , $ properties , $ coords , $ is3D ]) {
66
- yield [$ geojson , $ properties , $ coords , $ is3D , false ];
67
- yield [self ::alterCase ($ geojson ), $ properties , $ coords , $ is3D , true ];
65
+ foreach (self ::providerFeatureGeoJson () as [$ geoJson , $ properties , $ coords , $ is3D ]) {
66
+ yield [$ geoJson , $ properties , $ coords , $ is3D , false ];
67
+ yield [self ::alterCase ($ geoJson ), $ properties , $ coords , $ is3D , true ];
68
68
}
69
69
}
70
70
71
71
/**
72
- * @param string $geojson The GeoJSON to read.
72
+ * @param string $geoJson The GeoJSON to read.
73
73
* @param array[] $coords The expected Point coordinates.
74
74
* @param bool[] $is3D Whether the resulting Point has a Z coordinate.
75
75
* @param bool $lenient Whether to be lenient about case-sensitivity.
76
76
*/
77
77
#[DataProvider('providerReadFeatureCollection ' )]
78
- public function testReadFeatureCollection (string $ geojson , array $ properties , array $ coords , array $ is3D , bool $ lenient ) : void
78
+ public function testReadFeatureCollection (string $ geoJson , array $ properties , array $ coords , array $ is3D , bool $ lenient ) : void
79
79
{
80
- $ featureCollection = (new GeoJsonReader ($ lenient ))->read ($ geojson );
80
+ $ featureCollection = (new GeoJsonReader ($ lenient ))->read ($ geoJson );
81
81
82
82
self ::assertInstanceOf (FeatureCollection::class, $ featureCollection );
83
83
@@ -90,9 +90,9 @@ public function testReadFeatureCollection(string $geojson, array $properties, ar
90
90
91
91
public static function providerReadFeatureCollection () : \Generator
92
92
{
93
- foreach (self ::providerFeatureCollectionGeoJson () as [$ geojson , $ properties , $ coords , $ is3D ]) {
94
- yield [$ geojson , $ properties , $ coords , $ is3D , false ];
95
- yield [self ::alterCase ($ geojson ), $ properties , $ coords , $ is3D , true ];
93
+ foreach (self ::providerFeatureCollectionGeoJson () as [$ geoJson , $ properties , $ coords , $ is3D ]) {
94
+ yield [$ geoJson , $ properties , $ coords , $ is3D , false ];
95
+ yield [self ::alterCase ($ geoJson ), $ properties , $ coords , $ is3D , true ];
96
96
}
97
97
}
98
98
@@ -248,14 +248,14 @@ public function testNestedGeometryCollectionInLenientMode(): void
248
248
}
249
249
250
250
#[DataProvider('providerWrongCaseTypeInNonLenientMode ' )]
251
- public function testWrongCaseTypeInNonLenientMode (string $ geojson , string $ expectedExceptionMessage ) : void
251
+ public function testWrongCaseTypeInNonLenientMode (string $ geoJson , string $ expectedExceptionMessage ) : void
252
252
{
253
253
$ reader = new GeoJsonReader ();
254
254
255
255
$ this ->expectException (GeometryIoException::class);
256
256
$ this ->expectExceptionMessage ($ expectedExceptionMessage );
257
257
258
- $ reader ->read ($ geojson );
258
+ $ reader ->read ($ geoJson );
259
259
}
260
260
261
261
public static function providerWrongCaseTypeInNonLenientMode () : \Generator
@@ -285,10 +285,10 @@ public static function providerWrongCaseTypeInNonLenientMode() : \Generator
285
285
/**
286
286
* Changes the case of type attributes.
287
287
*/
288
- private static function alterCase (string $ geojson ) : string
288
+ private static function alterCase (string $ geoJson ) : string
289
289
{
290
290
$ callback = fn (array $ matches ): string => $ matches [1 ] . strtoupper ($ matches [2 ]);
291
291
292
- return preg_replace_callback ('/("type"\s*\:\s*)("[^"]+")/ ' , $ callback , $ geojson );
292
+ return preg_replace_callback ('/("type"\s*\:\s*)("[^"]+")/ ' , $ callback , $ geoJson );
293
293
}
294
294
}
0 commit comments