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
|
|
|
|