@@ -23,10 +23,7 @@ public function testCenterCoordinates(float $minLatitude, float $minLongitude, f
2323 {
2424 $ boundingBox = new BoundingBox ($ minLatitude , $ maxLatitude , $ minLongitude , $ maxLongitude );
2525
26- $ this ->assertEquals ($ minLatitude , $ boundingBox ->getMinLatitude ());
27- $ this ->assertEquals ($ maxLatitude , $ boundingBox ->getMaxLatitude ());
28- $ this ->assertEquals ($ minLongitude , $ boundingBox ->getMinLongitude ());
29- $ this ->assertEquals ($ maxLongitude , $ boundingBox ->getMaxLongitude ());
26+ $ this ->assertThatBoundingBoxEquals ([$ minLatitude , $ maxLatitude , $ minLongitude , $ maxLongitude ], $ boundingBox );
3027 $ this ->assertEquals ($ expectedCenterLatitude , $ boundingBox ->getCenterLatitude ());
3128 $ this ->assertEquals ($ expectedCenterLongitude , $ boundingBox ->getCenterLongitude ());
3229 }
@@ -40,4 +37,21 @@ public function getProviderForCenterCoordinates()
4037 [15.0 , -160.0 , 19.0 , -60.0 , 17.0 , -110.0 ]
4138 ];
4239 }
40+
41+ public function testExtendByZero ()
42+ {
43+ $ boundingBox = new BoundingBox (49.6 , 7.6 , 49.7 , 7.7 );
44+
45+ $ this ->assertThatBoundingBoxEquals ([49.6 , 7.6 , 49.7 , 7.7 ], $ boundingBox );
46+ $ this ->assertThatBoundingBoxEquals ([49.6 , 7.6 , 49.7 , 7.7 ], $ boundingBox ->extendBy (0.0 ));
47+ $ this ->assertThatBoundingBoxEquals ([49.6 , 7.6 , 49.7 , 7.7 ], $ boundingBox ->extendBy (0.0 , 0.0 , 0.0 , 0.0 ));
48+ }
49+
50+ protected function assertThatBoundingBoxEquals (array $ expectedBoundaries , BoundingBox $ boundingBox )
51+ {
52+ $ this ->assertEquals ($ expectedBoundaries [0 ], $ boundingBox ->getMinLatitude ());
53+ $ this ->assertEquals ($ expectedBoundaries [1 ], $ boundingBox ->getMaxLatitude ());
54+ $ this ->assertEquals ($ expectedBoundaries [2 ], $ boundingBox ->getMinLongitude ());
55+ $ this ->assertEquals ($ expectedBoundaries [3 ], $ boundingBox ->getMaxLongitude ());
56+ }
4357}
0 commit comments