1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Maps\Tests\Elements; |
4
|
|
|
|
5
|
|
|
use DataValues\Geo\Values\LatLongValue; |
6
|
|
|
use Maps\Elements\Circle; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* @covers Maps\Elements\Circle |
10
|
|
|
* |
11
|
|
|
* @since 3.0 |
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 'Maps\Elements\Circle'; |
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 ), 'foo' ]; |
44
|
|
|
|
45
|
|
|
$argLists[] = [ new LatLongValue( 4, 2 ), 0 ]; |
46
|
|
|
$argLists[] = [ new LatLongValue( 4, 2 ), -42 ]; |
47
|
|
|
|
48
|
|
|
return $argLists; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @dataProvider instanceProvider |
53
|
|
|
* @param Circle $circle |
54
|
|
|
* @param array $arguments |
55
|
|
|
*/ |
56
|
|
|
public function testGetCircleCentre( Circle $circle, array $arguments ) { |
57
|
|
|
$this->assertTrue( $circle->getCircleCentre()->equals( $arguments[0] ) ); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @dataProvider instanceProvider |
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
|
|
|
|