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