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

SubObjectBuilderTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 42
c 0
b 0
f 0
wmc 3
lcom 0
cbo 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testEmptyGeoJson() 0 5 1
A newBuilder() 0 3 1
A testPoint() 0 28 1
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