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

CircleTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 3
dl 0
loc 54
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getClass() 0 3 1
A validConstructorProvider() 0 10 1
A invalidConstructorProvider() 0 8 1
A testGetCircleCentre() 0 3 1
A testGetCircleRadius() 0 3 1
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\Circle;
9
10
/**
11
 * @covers \Maps\LegacyModel\Circle
12
 *
13
 * @licence GNU GPL v2+
14
 * @author Jeroen De Dauw < [email protected] >
15
 */
16
class CircleTest extends BaseElementTest {
17
18
	/**
19
	 * @see BaseElementTest::getClass
20
	 *
21
	 * @since 3.0
22
	 *
23
	 * @return string
24
	 */
25
	public function getClass() {
26
		return Circle::class;
27
	}
28
29
	public function validConstructorProvider() {
30
		$argLists = [];
31
32
		$argLists[] = [ new LatLongValue( 4, 2 ), 42 ];
33
		$argLists[] = [ new LatLongValue( 42, 2.2 ), 9000.1 ];
34
		$argLists[] = [ new LatLongValue( 4, 2 ), 1 ];
35
		$argLists[] = [ new LatLongValue( 4, 2 ), 0.1 ];
36
37
		return $argLists;
38
	}
39
40
	public function invalidConstructorProvider() {
41
		$argLists = [];
42
43
		$argLists[] = [ new LatLongValue( 4, 2 ), 0 ];
44
		$argLists[] = [ new LatLongValue( 4, 2 ), -42 ];
45
46
		return $argLists;
47
	}
48
49
	/**
50
	 * @dataProvider instanceProvider
51
	 *
52
	 * @param Circle $circle
53
	 * @param array $arguments
54
	 */
55
	public function testGetCircleCentre( Circle $circle, array $arguments ) {
56
		$this->assertTrue( $circle->getCircleCentre()->equals( $arguments[0] ) );
57
	}
58
59
	/**
60
	 * @dataProvider instanceProvider
61
	 *
62
	 * @param Circle $circle
63
	 * @param array $arguments
64
	 */
65
	public function testGetCircleRadius( Circle $circle, array $arguments ) {
66
		$this->assertEquals( $arguments[1], $circle->getCircleRadius() );
67
	}
68
69
}
70
71
72
73