Completed
Push — master ( 81538e...c2bf57 )
by Jeroen De
10:06
created

LineTest::validConstructorProvider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 9.7333
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace Maps\Tests\Unit\LegacyModel;
6
7
use DataValues\Geo\Values\LatLongValue;
8
use Maps\LegacyModel\Line;
9
10
/**
11
 * @covers \Maps\LegacyModel\Line
12
 *
13
 * @licence GNU GPL v2+
14
 * @author Jeroen De Dauw < [email protected] >
15
 */
16
class LineTest extends BaseElementTest {
17
18
	/**
19
	 * @see BaseElementTest::getClass
20
	 *
21
	 * @since 3.0
22
	 *
23
	 * @return string
24
	 */
25
	public function getClass() {
26
		return Line::class;
27
	}
28
29
	public function validConstructorProvider() {
30
		$argLists = [];
31
32
		$argLists[] = [ [] ];
33
		$argLists[] = [ [ new LatLongValue( 4, 2 ) ] ];
34
35
		$argLists[] = [
36
			[
37
				new LatLongValue( 4, 2 ),
38
				new LatLongValue( 2, 4 ),
39
				new LatLongValue( 42, 42 ),
40
			]
41
		];
42
43
		return $argLists;
44
	}
45
46
	public function invalidConstructorProvider() {
47
		$argLists = [];
48
49
		$argLists[] = [ [ '~=[,,_,,]:3' ] ];
50
		$argLists[] = [ [ new LatLongValue( 4, 2 ), '~=[,,_,,]:3' ] ];
51
		$argLists[] = [ [ '~=[,,_,,]:3', new LatLongValue( 4, 2 ) ] ];
52
53
		return $argLists;
54
	}
55
56
	/**
57
	 * @dataProvider instanceProvider
58
	 *
59
	 * @param Line $line
60
	 * @param array $arguments
61
	 */
62
	public function testGetLineCoordinates( Line $line, array $arguments ) {
63
		$coordinates = $line->getLineCoordinates();
64
65
		$this->assertInternalType( 'array', $coordinates );
66
		$this->assertEquals( count( $arguments[0] ), count( $coordinates ) );
67
68
		foreach ( $coordinates as $geoCoordinate ) {
69
			$this->assertInstanceOf( LatLongValue::class, $geoCoordinate );
70
		}
71
	}
72
73
}
74
75
76
77