Completed
Push — SemanticGeoJson ( e5361a...e30e84 )
by Jeroen De
03:54
created

SubObjectBuilderTest::testPoint()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 28

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 28
c 0
b 0
f 0
rs 9.472
cc 1
nc 1
nop 0
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace Maps\Tests\Integration\DataAccess\GeoJsonStore;
6
7
use Maps\DataAccess\GeoJsonStore\SubObjectBuilder;
8
use PHPUnit\Framework\TestCase;
9
10
/**
11
 * @covers \Maps\DataAccess\GeoJsonStore\SubObjectBuilder
12
 */
13
class SubObjectBuilderTest extends TestCase {
14
15
	public function testEmptyGeoJson() {
16
		$objects = $this->newBuilder()->getSubObjectsFromGeoJson( '{"type": "FeatureCollection", "features": []}' );
17
18
		$this->assertSame( [], $objects );
19
	}
20
21
	private function newBuilder(): SubObjectBuilder {
22
		return new SubObjectBuilder( \Title::newFromText( 'GeoJson:TestGeoJson' ) );
23
	}
24
25
	public function testPoint() {
26
		$objects = $this->newBuilder()->getSubObjectsFromGeoJson(
27
			<<<'EOD'
28
{
29
    "type": "FeatureCollection",
30
    "features": [
31
        {
32
            "type": "Feature",
33
            "properties": {
34
                "title": "Berlin",
35
                "description": "The capital of Germany"
36
            },
37
            "geometry": {
38
                "type": "Point",
39
                "coordinates": [
40
                    13.388729,
41
                    52.516524
42
                ]
43
            }
44
        }
45
    ]
46
}
47
EOD
48
49
		);
50
51
		$this->assertSame( [], $objects );
52
	}
53
54
}
55