@@ -229,10 +229,11 @@ public function testScopeDistance()
229229 $ this ->assertInstanceOf (\Grimzy \LaravelMysqlSpatial \Eloquent \Builder::class, $ query );
230230 $ q = $ query ->getQuery ();
231231 $ this ->assertNotEmpty ($ q ->wheres );
232- $ this ->assertNotEmpty ($ q ->bindings ['where ' ]);
232+ $ bindings = $ q ->getRawBindings ()['where ' ];
233+ $ this ->assertNotEmpty ($ bindings );
233234 $ this ->assertEquals ('st_distance(`point`, ST_GeomFromText(?)) <= ? ' , $ q ->wheres [0 ]['sql ' ]);
234- $ this ->assertEquals ('POINT(2 1) ' , $ q -> bindings [ ' where ' ] [0 ]);
235- $ this ->assertEquals (10 , $ q -> bindings [ ' where ' ] [1 ]);
235+ $ this ->assertEquals ('POINT(2 1) ' , $ bindings [0 ]);
236+ $ this ->assertEquals (10 , $ bindings [1 ]);
236237 }
237238
238239 public function testScopeDistanceExcludingSelf ()
@@ -243,12 +244,13 @@ public function testScopeDistanceExcludingSelf()
243244 $ this ->assertInstanceOf (\Grimzy \LaravelMysqlSpatial \Eloquent \Builder::class, $ query );
244245 $ q = $ query ->getQuery ();
245246 $ this ->assertNotEmpty ($ q ->wheres );
246- $ this ->assertNotEmpty ($ q ->bindings ['where ' ]);
247+ $ bindings = $ q ->getRawBindings ()['where ' ];
248+ $ this ->assertNotEmpty ($ bindings );
247249 $ this ->assertEquals ('st_distance(`point`, ST_GeomFromText(?)) <= ? ' , $ q ->wheres [0 ]['sql ' ]);
248250 $ this ->assertEquals ('st_distance(`point`, ST_GeomFromText(?)) != 0 ' , $ q ->wheres [1 ]['sql ' ]);
249- $ this ->assertEquals ('POINT(2 1) ' , $ q -> bindings [ ' where ' ] [0 ]);
250- $ this ->assertEquals (10 , $ q -> bindings [ ' where ' ] [1 ]);
251- $ this ->assertEquals ('POINT(2 1) ' , $ q -> bindings [ ' where ' ] [2 ]);
251+ $ this ->assertEquals ('POINT(2 1) ' , $ bindings [0 ]);
252+ $ this ->assertEquals (10 , $ bindings [1 ]);
253+ $ this ->assertEquals ('POINT(2 1) ' , $ bindings [2 ]);
252254 }
253255
254256 public function testScopeDistanceSphere ()
@@ -259,10 +261,11 @@ public function testScopeDistanceSphere()
259261 $ this ->assertInstanceOf (\Grimzy \LaravelMysqlSpatial \Eloquent \Builder::class, $ query );
260262 $ q = $ query ->getQuery ();
261263 $ this ->assertNotEmpty ($ q ->wheres );
262- $ this ->assertNotEmpty ($ q ->bindings ['where ' ]);
264+ $ bindings = $ q ->getRawBindings ()['where ' ];
265+ $ this ->assertNotEmpty ($ bindings );
263266 $ this ->assertEquals ('st_distance_sphere(`point`, ST_GeomFromText(?)) <= ? ' , $ q ->wheres [0 ]['sql ' ]);
264- $ this ->assertEquals ('POINT(2 1) ' , $ q -> bindings [ ' where ' ] [0 ]);
265- $ this ->assertEquals (10 , $ q -> bindings [ ' where ' ] [1 ]);
267+ $ this ->assertEquals ('POINT(2 1) ' , $ bindings [0 ]);
268+ $ this ->assertEquals (10 , $ bindings [1 ]);
266269 }
267270
268271 public function testScopeDistanceSphereExcludingSelf ()
@@ -273,12 +276,13 @@ public function testScopeDistanceSphereExcludingSelf()
273276 $ this ->assertInstanceOf (\Grimzy \LaravelMysqlSpatial \Eloquent \Builder::class, $ query );
274277 $ q = $ query ->getQuery ();
275278 $ this ->assertNotEmpty ($ q ->wheres );
276- $ this ->assertNotEmpty ($ q ->bindings ['where ' ]);
279+ $ bindings = $ q ->getRawBindings ()['where ' ];
280+ $ this ->assertNotEmpty ($ bindings );
277281 $ this ->assertEquals ('st_distance_sphere(`point`, ST_GeomFromText(?)) <= ? ' , $ q ->wheres [0 ]['sql ' ]);
278282 $ this ->assertEquals ('st_distance_sphere(point, ST_GeomFromText(?)) != 0 ' , $ q ->wheres [1 ]['sql ' ]);
279- $ this ->assertEquals ('POINT(2 1) ' , $ q -> bindings [ ' where ' ] [0 ]);
280- $ this ->assertEquals (10 , $ q -> bindings [ ' where ' ] [1 ]);
281- $ this ->assertEquals ('POINT(2 1) ' , $ q -> bindings [ ' where ' ] [2 ]);
283+ $ this ->assertEquals ('POINT(2 1) ' , $ bindings [0 ]);
284+ $ this ->assertEquals (10 , $ bindings [1 ]);
285+ $ this ->assertEquals ('POINT(2 1) ' , $ bindings [2 ]);
282286 }
283287
284288 public function testScopeDistanceValue ()
@@ -289,11 +293,12 @@ public function testScopeDistanceValue()
289293 $ this ->assertInstanceOf (\Grimzy \LaravelMysqlSpatial \Eloquent \Builder::class, $ query );
290294 $ q = $ query ->getQuery ();
291295 $ this ->assertNotEmpty ($ q ->columns );
292- $ this ->assertNotEmpty ($ q ->bindings ['select ' ]);
296+ $ bindings = $ q ->getRawBindings ()['select ' ];
297+ $ this ->assertNotEmpty ($ bindings );
293298 $ this ->assertEquals ('* ' , $ q ->columns [0 ]);
294299 $ this ->assertInstanceOf (\Illuminate \Database \Query \Expression::class, $ q ->columns [1 ]);
295300 $ this ->assertEquals ('st_distance(`point`, ST_GeomFromText(?)) as distance ' , $ q ->columns [1 ]->getValue ());
296- $ this ->assertEquals ('POINT(2 1) ' , $ q -> bindings [ ' select ' ] [0 ]);
301+ $ this ->assertEquals ('POINT(2 1) ' , $ bindings [0 ]);
297302 }
298303
299304 public function testScopeDistanceValueWithSelect ()
@@ -304,11 +309,12 @@ public function testScopeDistanceValueWithSelect()
304309 $ this ->assertInstanceOf (\Grimzy \LaravelMysqlSpatial \Eloquent \Builder::class, $ query );
305310 $ q = $ query ->getQuery ();
306311 $ this ->assertNotEmpty ($ q ->columns );
307- $ this ->assertNotEmpty ($ q ->bindings ['select ' ]);
312+ $ bindings = $ q ->getRawBindings ()['select ' ];
313+ $ this ->assertNotEmpty ($ bindings );
308314 $ this ->assertEquals ('some_column ' , $ q ->columns [0 ]);
309315 $ this ->assertInstanceOf (\Illuminate \Database \Query \Expression::class, $ q ->columns [1 ]);
310316 $ this ->assertEquals ('st_distance(`point`, ST_GeomFromText(?)) as distance ' , $ q ->columns [1 ]->getValue ());
311- $ this ->assertEquals ('POINT(2 1) ' , $ q -> bindings [ ' select ' ] [0 ]);
317+ $ this ->assertEquals ('POINT(2 1) ' , $ bindings [0 ]);
312318 }
313319
314320 public function testScopeDistanceSphereValue ()
@@ -319,11 +325,12 @@ public function testScopeDistanceSphereValue()
319325 $ this ->assertInstanceOf (\Grimzy \LaravelMysqlSpatial \Eloquent \Builder::class, $ query );
320326 $ q = $ query ->getQuery ();
321327 $ this ->assertNotEmpty ($ q ->columns );
322- $ this ->assertNotEmpty ($ q ->bindings ['select ' ]);
328+ $ bindings = $ q ->getRawBindings ()['select ' ];
329+ $ this ->assertNotEmpty ($ bindings );
323330 $ this ->assertEquals ('* ' , $ q ->columns [0 ]);
324331 $ this ->assertInstanceOf (\Illuminate \Database \Query \Expression::class, $ q ->columns [1 ]);
325332 $ this ->assertEquals ('st_distance_sphere(`point`, ST_GeomFromText(?)) as distance ' , $ q ->columns [1 ]->getValue ());
326- $ this ->assertEquals ('POINT(2 1) ' , $ q -> bindings [ ' select ' ] [0 ]);
333+ $ this ->assertEquals ('POINT(2 1) ' , $ bindings [0 ]);
327334 }
328335
329336 public function testScopeDistanceSphereValueWithSelect ()
@@ -334,11 +341,12 @@ public function testScopeDistanceSphereValueWithSelect()
334341 $ this ->assertInstanceOf (\Grimzy \LaravelMysqlSpatial \Eloquent \Builder::class, $ query );
335342 $ q = $ query ->getQuery ();
336343 $ this ->assertNotEmpty ($ q ->columns );
337- $ this ->assertNotEmpty ($ q ->bindings ['select ' ]);
344+ $ bindings = $ q ->getRawBindings ()['select ' ];
345+ $ this ->assertNotEmpty ($ bindings );
338346 $ this ->assertEquals ('some_column ' , $ q ->columns [0 ]);
339347 $ this ->assertInstanceOf (\Illuminate \Database \Query \Expression::class, $ q ->columns [1 ]);
340348 $ this ->assertEquals ('st_distance_sphere(`point`, ST_GeomFromText(?)) as distance ' , $ q ->columns [1 ]->getValue ());
341- $ this ->assertEquals ('POINT(2 1) ' , $ q -> bindings [ ' select ' ] [0 ]);
349+ $ this ->assertEquals ('POINT(2 1) ' , $ bindings [0 ]);
342350 }
343351
344352 private function buildTestPolygon ()
@@ -363,9 +371,10 @@ public function testScopeComparison()
363371 $ this ->assertInstanceOf (\Grimzy \LaravelMysqlSpatial \Eloquent \Builder::class, $ query );
364372 $ q = $ query ->getQuery ();
365373 $ this ->assertNotEmpty ($ q ->wheres );
366- $ this ->assertNotEmpty ($ q ->bindings ['where ' ]);
374+ $ bindings = $ q ->getRawBindings ()['where ' ];
375+ $ this ->assertNotEmpty ($ bindings );
367376 $ this ->assertContains ('st_within(`point`, ST_GeomFromText(?)) ' , $ q ->wheres [0 ]['sql ' ]);
368- $ this ->assertEquals ('POLYGON((1 1,2 1),(2 1,2 2),(2 2,1 1)) ' , $ q -> bindings [ ' where ' ] [0 ]);
377+ $ this ->assertEquals ('POLYGON((1 1,2 1),(2 1,2 2),(2 2,1 1)) ' , $ bindings [0 ]);
369378 }
370379
371380 public function testScopeWithin ()
@@ -375,9 +384,10 @@ public function testScopeWithin()
375384 $ this ->assertInstanceOf (\Grimzy \LaravelMysqlSpatial \Eloquent \Builder::class, $ query );
376385 $ q = $ query ->getQuery ();
377386 $ this ->assertNotEmpty ($ q ->wheres );
378- $ this ->assertNotEmpty ($ q ->bindings ['where ' ]);
387+ $ bindings = $ q ->getRawBindings ()['where ' ];
388+ $ this ->assertNotEmpty ($ bindings );
379389 $ this ->assertContains ('st_within(`point`, ST_GeomFromText(?)) ' , $ q ->wheres [0 ]['sql ' ]);
380- $ this ->assertEquals ('POLYGON((1 1,2 1),(2 1,2 2),(2 2,1 1)) ' , $ q -> bindings [ ' where ' ] [0 ]);
390+ $ this ->assertEquals ('POLYGON((1 1,2 1),(2 1,2 2),(2 2,1 1)) ' , $ bindings [0 ]);
381391 }
382392
383393 public function testScopeCrosses ()
@@ -387,9 +397,10 @@ public function testScopeCrosses()
387397 $ this ->assertInstanceOf (\Grimzy \LaravelMysqlSpatial \Eloquent \Builder::class, $ query );
388398 $ q = $ query ->getQuery ();
389399 $ this ->assertNotEmpty ($ q ->wheres );
390- $ this ->assertNotEmpty ($ q ->bindings ['where ' ]);
400+ $ bindings = $ q ->getRawBindings ()['where ' ];
401+ $ this ->assertNotEmpty ($ bindings );
391402 $ this ->assertContains ('st_crosses(`point`, ST_GeomFromText(?)) ' , $ q ->wheres [0 ]['sql ' ]);
392- $ this ->assertEquals ('POLYGON((1 1,2 1),(2 1,2 2),(2 2,1 1)) ' , $ q -> bindings [ ' where ' ] [0 ]);
403+ $ this ->assertEquals ('POLYGON((1 1,2 1),(2 1,2 2),(2 2,1 1)) ' , $ bindings [0 ]);
393404 }
394405
395406 public function testScopeContains ()
@@ -399,9 +410,10 @@ public function testScopeContains()
399410 $ this ->assertInstanceOf (\Grimzy \LaravelMysqlSpatial \Eloquent \Builder::class, $ query );
400411 $ q = $ query ->getQuery ();
401412 $ this ->assertNotEmpty ($ q ->wheres );
402- $ this ->assertNotEmpty ($ q ->bindings ['where ' ]);
413+ $ bindings = $ q ->getRawBindings ()['where ' ];
414+ $ this ->assertNotEmpty ($ bindings );
403415 $ this ->assertContains ('st_contains(`point`, ST_GeomFromText(?)) ' , $ q ->wheres [0 ]['sql ' ]);
404- $ this ->assertEquals ('POLYGON((1 1,2 1),(2 1,2 2),(2 2,1 1)) ' , $ q -> bindings [ ' where ' ] [0 ]);
416+ $ this ->assertEquals ('POLYGON((1 1,2 1),(2 1,2 2),(2 2,1 1)) ' , $ bindings [0 ]);
405417 }
406418
407419 public function testScopeDisjoint ()
@@ -411,9 +423,10 @@ public function testScopeDisjoint()
411423 $ this ->assertInstanceOf (\Grimzy \LaravelMysqlSpatial \Eloquent \Builder::class, $ query );
412424 $ q = $ query ->getQuery ();
413425 $ this ->assertNotEmpty ($ q ->wheres );
414- $ this ->assertNotEmpty ($ q ->bindings ['where ' ]);
426+ $ bindings = $ q ->getRawBindings ()['where ' ];
427+ $ this ->assertNotEmpty ($ bindings );
415428 $ this ->assertContains ('st_disjoint(`point`, ST_GeomFromText(?)) ' , $ q ->wheres [0 ]['sql ' ]);
416- $ this ->assertEquals ('POLYGON((1 1,2 1),(2 1,2 2),(2 2,1 1)) ' , $ q -> bindings [ ' where ' ] [0 ]);
429+ $ this ->assertEquals ('POLYGON((1 1,2 1),(2 1,2 2),(2 2,1 1)) ' , $ bindings [0 ]);
417430 }
418431
419432 public function testScopeEquals ()
@@ -423,9 +436,10 @@ public function testScopeEquals()
423436 $ this ->assertInstanceOf (\Grimzy \LaravelMysqlSpatial \Eloquent \Builder::class, $ query );
424437 $ q = $ query ->getQuery ();
425438 $ this ->assertNotEmpty ($ q ->wheres );
426- $ this ->assertNotEmpty ($ q ->bindings ['where ' ]);
439+ $ bindings = $ q ->getRawBindings ()['where ' ];
440+ $ this ->assertNotEmpty ($ bindings );
427441 $ this ->assertContains ('st_equals(`point`, ST_GeomFromText(?)) ' , $ q ->wheres [0 ]['sql ' ]);
428- $ this ->assertEquals ('POLYGON((1 1,2 1),(2 1,2 2),(2 2,1 1)) ' , $ q -> bindings [ ' where ' ] [0 ]);
442+ $ this ->assertEquals ('POLYGON((1 1,2 1),(2 1,2 2),(2 2,1 1)) ' , $ bindings [0 ]);
429443 }
430444
431445 public function testScopeIntersects ()
@@ -435,9 +449,10 @@ public function testScopeIntersects()
435449 $ this ->assertInstanceOf (\Grimzy \LaravelMysqlSpatial \Eloquent \Builder::class, $ query );
436450 $ q = $ query ->getQuery ();
437451 $ this ->assertNotEmpty ($ q ->wheres );
438- $ this ->assertNotEmpty ($ q ->bindings ['where ' ]);
452+ $ bindings = $ q ->getRawBindings ()['where ' ];
453+ $ this ->assertNotEmpty ($ bindings );
439454 $ this ->assertContains ('st_intersects(`point`, ST_GeomFromText(?)) ' , $ q ->wheres [0 ]['sql ' ]);
440- $ this ->assertEquals ('POLYGON((1 1,2 1),(2 1,2 2),(2 2,1 1)) ' , $ q -> bindings [ ' where ' ] [0 ]);
455+ $ this ->assertEquals ('POLYGON((1 1,2 1),(2 1,2 2),(2 2,1 1)) ' , $ bindings [0 ]);
441456 }
442457
443458 public function testScopeOverlaps ()
@@ -447,9 +462,10 @@ public function testScopeOverlaps()
447462 $ this ->assertInstanceOf (\Grimzy \LaravelMysqlSpatial \Eloquent \Builder::class, $ query );
448463 $ q = $ query ->getQuery ();
449464 $ this ->assertNotEmpty ($ q ->wheres );
450- $ this ->assertNotEmpty ($ q ->bindings ['where ' ]);
465+ $ bindings = $ q ->getRawBindings ()['where ' ];
466+ $ this ->assertNotEmpty ($ bindings );
451467 $ this ->assertContains ('st_overlaps(`point`, ST_GeomFromText(?)) ' , $ q ->wheres [0 ]['sql ' ]);
452- $ this ->assertEquals ('POLYGON((1 1,2 1),(2 1,2 2),(2 2,1 1)) ' , $ q -> bindings [ ' where ' ] [0 ]);
468+ $ this ->assertEquals ('POLYGON((1 1,2 1),(2 1,2 2),(2 2,1 1)) ' , $ bindings [0 ]);
453469 }
454470
455471 public function testScopeDoesTouch ()
@@ -459,9 +475,10 @@ public function testScopeDoesTouch()
459475 $ this ->assertInstanceOf (\Grimzy \LaravelMysqlSpatial \Eloquent \Builder::class, $ query );
460476 $ q = $ query ->getQuery ();
461477 $ this ->assertNotEmpty ($ q ->wheres );
462- $ this ->assertNotEmpty ($ q ->bindings ['where ' ]);
478+ $ bindings = $ q ->getRawBindings ()['where ' ];
479+ $ this ->assertNotEmpty ($ bindings );
463480 $ this ->assertContains ('st_touches(`point`, ST_GeomFromText(?)) ' , $ q ->wheres [0 ]['sql ' ]);
464- $ this ->assertEquals ('POLYGON((1 1,2 1),(2 1,2 2),(2 2,1 1)) ' , $ q -> bindings [ ' where ' ] [0 ]);
481+ $ this ->assertEquals ('POLYGON((1 1,2 1),(2 1,2 2),(2 2,1 1)) ' , $ bindings [0 ]);
465482 }
466483}
467484
0 commit comments