1 | <?php |
||
19 | class GlobeCoordinateValueTest extends DataValueTest { |
||
20 | |||
21 | /** |
||
22 | * @see DataValueTest::getClass |
||
23 | * |
||
24 | * @return string |
||
25 | */ |
||
26 | public function getClass() { |
||
27 | return 'DataValues\Geo\Values\GlobeCoordinateValue'; |
||
28 | } |
||
29 | |||
30 | public function validConstructorArgumentsProvider() { |
||
31 | $argLists = array(); |
||
32 | |||
33 | $argLists[] = array( new LatLongValue( 4.2, 4.2 ), 1 ); |
||
34 | $argLists[] = array( new LatLongValue( 4.2, 42 ), 1 ); |
||
35 | $argLists[] = array( new LatLongValue( 42, 4.2 ), 0.1 ); |
||
36 | $argLists[] = array( new LatLongValue( 42, 42 ), 0.1 ); |
||
37 | $argLists[] = array( new LatLongValue( -4.2, -4.2 ), 0.1 ); |
||
38 | $argLists[] = array( new LatLongValue( 4.2, -42 ), 0.1 ); |
||
39 | $argLists[] = array( new LatLongValue( -42, 4.2 ), 10 ); |
||
40 | $argLists[] = array( new LatLongValue( 0, 0 ), 0.001 ); |
||
41 | $argLists[] = array( new LatLongValue( 0, 0 ), 360 ); |
||
42 | $argLists[] = array( new LatLongValue( 0, 0 ), -360 ); |
||
43 | |||
44 | $argLists[] = array( new LatLongValue( 4.2, 4.2 ), 1, GlobeCoordinateValue::GLOBE_EARTH ); |
||
45 | $argLists[] = array( new LatLongValue( 4.2, 4.2 ), 1, 'terminus' ); |
||
46 | $argLists[] = array( new LatLongValue( 4.2, 4.2 ), 1, "Schar's World" ); |
||
47 | $argLists[] = array( new LatLongValue( 4.2, 4.2 ), 1, 'coruscant' ); |
||
48 | $argLists[] = array( new LatLongValue( 4.2, 4.2 ), 1, null ); |
||
49 | $argLists[] = array( new LatLongValue( 4.2, 4.2 ), null ); |
||
50 | |||
51 | return $argLists; |
||
52 | } |
||
53 | |||
54 | public function invalidConstructorArgumentsProvider() { |
||
55 | $argLists = array(); |
||
56 | |||
57 | $argLists[] = array( new LatLongValue( 4.2, 4.2 ), 361 ); |
||
58 | $argLists[] = array( new LatLongValue( 4.2, 4.2 ), -361 ); |
||
59 | $argLists[] = array( new LatLongValue( 4.2, 4.2 ), 'foo' ); |
||
60 | $argLists[] = array( new LatLongValue( 4.2, 4.2 ), true ); |
||
61 | $argLists[] = array( new LatLongValue( 4.2, 4.2 ), array( 1 ) ); |
||
62 | $argLists[] = array( new LatLongValue( 4.2, 4.2 ), '1' ); |
||
63 | |||
64 | $argLists[] = array( new LatLongValue( 4.2, 4.2 ), 1, '' ); |
||
65 | $argLists[] = array( new LatLongValue( 4.2, 4.2 ), 1, true ); |
||
66 | $argLists[] = array( new LatLongValue( 4.2, 4.2 ), 1, array( 1 ) ); |
||
67 | $argLists[] = array( new LatLongValue( 4.2, 4.2 ), 1, 1 ); |
||
68 | |||
69 | return $argLists; |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * @dataProvider instanceProvider |
||
74 | */ |
||
75 | public function testGetLatitude( GlobeCoordinateValue $globeCoordinate, array $arguments ) { |
||
76 | $actual = $globeCoordinate->getLatitude(); |
||
77 | |||
78 | $this->assertInternalType( 'float', $actual ); |
||
79 | $this->assertSame( $arguments[0]->getLatitude(), $actual ); |
||
80 | } |
||
81 | |||
82 | /** |
||
83 | * @dataProvider instanceProvider |
||
84 | */ |
||
85 | public function testGetLongitude( GlobeCoordinateValue $globeCoordinate, array $arguments ) { |
||
86 | $actual = $globeCoordinate->getLongitude(); |
||
87 | |||
88 | $this->assertInternalType( 'float', $actual ); |
||
89 | $this->assertSame( $arguments[0]->getLongitude(), $actual ); |
||
90 | } |
||
91 | |||
92 | /** |
||
93 | * @dataProvider instanceProvider |
||
94 | */ |
||
95 | public function testGetPrecision( GlobeCoordinateValue $globeCoordinate, array $arguments ) { |
||
96 | $actual = $globeCoordinate->getPrecision(); |
||
97 | |||
98 | $this->assertTrue( |
||
99 | is_float( $actual ) || is_int( $actual ) || $actual === null, |
||
100 | 'Precision is int or float or null' |
||
101 | ); |
||
102 | $this->assertSame( $arguments[1], $actual ); |
||
103 | } |
||
104 | |||
105 | /** |
||
106 | * @dataProvider instanceProvider |
||
107 | */ |
||
108 | public function testGetGlobe( GlobeCoordinateValue $globeCoordinate, array $arguments ) { |
||
122 | |||
123 | public function provideIllegalArrayValue() { |
||
124 | return [ |
||
125 | [ null ], |
||
126 | [ '' ], |
||
127 | [ [] ], |
||
128 | [ [ 'latitude' => 0 ] ], |
||
132 | |||
133 | /** |
||
134 | * @dataProvider provideIllegalArrayValue |
||
135 | */ |
||
136 | public function testNewFromArrayErrorHandling( $data ) { |
||
140 | |||
141 | public function testArrayValueCompatibility() { |
||
173 | |||
174 | public function testSerializeCompatibility() { |
||
189 | |||
190 | public function testHashIsConsistentAcrossDifferentRuntimeEnvironments() { |
||
197 | |||
198 | } |
||
199 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.