@@ -194,37 +194,22 @@ public function testDistance()
194194
195195 $ a = GeometryModel::distance (2 , $ loc1 ->location , 'location ' )->get ();
196196 $ this ->assertCount (2 , $ a );
197- $ this ->assertTrue ($ a ->contains ($ loc1 ));
198- $ this ->assertTrue ($ a ->contains ($ loc2 ));
199- $ this ->assertFalse ($ a ->contains ($ loc3 ));
197+ $ this ->assertTrue ($ a ->contains (' location ' , $ loc1-> location ));
198+ $ this ->assertTrue ($ a ->contains (' location ' , $ loc2-> location ));
199+ $ this ->assertFalse ($ a ->contains (' location ' , $ loc3-> location ));
200200
201201 // Excluding self
202202 $ b = GeometryModel::distance (2 , $ loc1 ->location , 'location ' , true )->get ();
203203 $ this ->assertCount (1 , $ b );
204- $ this ->assertFalse ($ b ->contains ($ loc1 ));
205- $ this ->assertTrue ($ b ->contains ($ loc2 ));
206- $ this ->assertFalse ($ b ->contains ($ loc3 ));
204+ $ this ->assertFalse ($ b ->contains (' location ' , $ loc1-> location ));
205+ $ this ->assertTrue ($ b ->contains (' location ' , $ loc2-> location ));
206+ $ this ->assertFalse ($ b ->contains (' location ' , $ loc3-> location ));
207207
208208 $ c = GeometryModel::distance (1 , $ loc1 ->location , 'location ' )->get ();
209209 $ this ->assertCount (1 , $ c );
210- $ this ->assertTrue ($ c ->contains ($ loc1 ));
211- $ this ->assertFalse ($ c ->contains ($ loc2 ));
212- $ this ->assertFalse ($ c ->contains ($ loc3 ));
213- }
214-
215- public function testDistanceSphere ()
216- {
217- $ loc1 = new GeometryModel ();
218- $ loc1 ->location = new Point (40.767864 , -73.971732 );
219- $ loc1 ->save ();
220-
221- $ loc2 = new GeometryModel ();
222- $ loc2 ->location = new Point (40.767664 , -73.971271 ); // Distance from loc1: 44.741406484588
223- $ loc2 ->save ();
224-
225- $ loc3 = new GeometryModel ();
226- $ loc3 ->location = new Point (40.761434 , -73.977619 ); // Distance from loc1: 870.06424066202
227- $ loc3 ->save ();
210+ $ this ->assertTrue ($ c ->contains ('location ' , $ loc1 ->location ));
211+ $ this ->assertFalse ($ c ->contains ('location ' , $ loc2 ->location ));
212+ $ this ->assertFalse ($ c ->contains ('location ' , $ loc3 ->location ));
228213 }
229214
230215 public function testDistanceValue ()
@@ -242,36 +227,4 @@ public function testDistanceValue()
242227 $ this ->assertEquals (0 , $ a [0 ]->distance );
243228 $ this ->assertEquals (1.4142135623 , $ a [1 ]->distance ); // PHP floats' 11th+ digits don't matter
244229 }
245-
246- public function testBounding () {
247- $ point = new Point (0 , 0 );
248-
249- $ linestring1 = \Grimzy \LaravelMysqlSpatial \Types \LineString::fromWkt ("LINESTRING(1 1, 2 2) " );
250- $ linestring2 = \Grimzy \LaravelMysqlSpatial \Types \LineString::fromWkt ("LINESTRING(20 20, 24 24) " );
251- $ linestring3 = \Grimzy \LaravelMysqlSpatial \Types \LineString::fromWkt ("LINESTRING(0 10, 10 10) " );
252-
253- $ geo1 = new GeometryModel ();
254- $ geo1 ->location = $ point ;
255- $ geo1 ->line = $ linestring1 ;
256- $ geo1 ->save ();
257-
258- $ geo2 = new GeometryModel ();
259- $ geo2 ->location = $ point ;
260- $ geo2 ->line = $ linestring2 ;
261- $ geo2 ->save ();
262-
263- $ geo3 = new GeometryModel ();
264- $ geo3 ->location = $ point ;
265- $ geo3 ->line = $ linestring3 ;
266- $ geo3 ->save ();
267-
268- $ polygon = Polygon::fromWKT ("POLYGON((0 10,10 10,10 0,0 0,0 10)) " );
269-
270- $ result = GeometryModel::Bounding ($ polygon , 'line ' )->get ();
271- $ this ->assertCount (2 , $ result );
272- $ this ->assertTrue ($ result ->contains ($ geo1 ));
273- $ this ->assertFalse ($ result ->contains ($ geo2 ));
274- $ this ->assertTrue ($ result ->contains ($ geo3 ));
275-
276- }
277230}
0 commit comments