@@ -36,14 +36,14 @@ public function testInsertUpdatePointHasCorrectSql()
3636 $ this ->model ->save ();
3737
3838 $ this ->assertStringStartsWith ('insert ' , $ this ->queries [0 ]);
39- $ this ->assertContains ("GeomFromText ('POINT(2 1)') " , $ this ->queries [0 ]);
39+ $ this ->assertContains ("ST_GeomFromText ('POINT(2 1)') " , $ this ->queries [0 ]);
4040 $ this ->assertTrue ($ this ->model ->exists );
4141
4242 $ this ->model ->point = new Point (1 , 2 );
4343 $ this ->model ->save ();
4444
4545 $ this ->assertStringStartsWith ('update ' , $ this ->queries [1 ]);
46- $ this ->assertContains ("GeomFromText ('POINT(2 1)') " , $ this ->queries [1 ]);
46+ $ this ->assertContains ("ST_GeomFromText ('POINT(2 1)') " , $ this ->queries [1 ]);
4747 }
4848
4949 public function testInsertUpdateLineStringHasCorrectSql ()
@@ -57,14 +57,14 @@ public function testInsertUpdateLineStringHasCorrectSql()
5757 $ this ->model ->save ();
5858
5959 $ this ->assertStringStartsWith ('insert ' , $ this ->queries [0 ]);
60- $ this ->assertContains ("GeomFromText ('LINESTRING(2 1,3 2)') " , $ this ->queries [0 ]);
60+ $ this ->assertContains ("ST_GeomFromText ('LINESTRING(2 1,3 2)') " , $ this ->queries [0 ]);
6161 $ this ->assertTrue ($ this ->model ->exists );
6262
6363 $ this ->model ->linestring = new \Grimzy \LaravelMysqlSpatial \Types \LineString ([$ point1 , $ point2 ]);
6464 $ this ->model ->save ();
6565
6666 $ this ->assertStringStartsWith ('update ' , $ this ->queries [1 ]);
67- $ this ->assertContains ("GeomFromText ('LINESTRING(2 1,3 2)') " , $ this ->queries [1 ]);
67+ $ this ->assertContains ("ST_GeomFromText ('LINESTRING(2 1,3 2)') " , $ this ->queries [1 ]);
6868 }
6969
7070 public function testInsertUpdatePolygonHasCorrectSql ()
@@ -82,13 +82,13 @@ public function testInsertUpdatePolygonHasCorrectSql()
8282 $ this ->model ->save ();
8383
8484 $ this ->assertStringStartsWith ('insert ' , $ this ->queries [0 ]);
85- $ this ->assertContains ("GeomFromText ('POLYGON((2 1,3 2),(2 3,1 2))') " , $ this ->queries [0 ]);
85+ $ this ->assertContains ("ST_GeomFromText ('POLYGON((2 1,3 2),(2 3,1 2))') " , $ this ->queries [0 ]);
8686 $ this ->assertTrue ($ this ->model ->exists );
8787
8888 $ this ->model ->polygon = new \Grimzy \LaravelMysqlSpatial \Types \Polygon ([$ linestring1 , $ linestring2 ]);
8989 $ this ->model ->save ();
9090 $ this ->assertStringStartsWith ('update ' , $ this ->queries [1 ]);
91- $ this ->assertContains ("GeomFromText ('POLYGON((2 1,3 2),(2 3,1 2))') " , $ this ->queries [1 ]);
91+ $ this ->assertContains ("ST_GeomFromText ('POLYGON((2 1,3 2),(2 3,1 2))') " , $ this ->queries [1 ]);
9292 }
9393
9494 public function testInsertUpdateMultiPointHasCorrectSql ()
@@ -102,14 +102,14 @@ public function testInsertUpdateMultiPointHasCorrectSql()
102102 $ this ->model ->save ();
103103
104104 $ this ->assertStringStartsWith ('insert ' , $ this ->queries [0 ]);
105- $ this ->assertContains ("GeomFromText ('MULTIPOINT((2 1),(3 2))') " , $ this ->queries [0 ]);
105+ $ this ->assertContains ("ST_GeomFromText ('MULTIPOINT((2 1),(3 2))') " , $ this ->queries [0 ]);
106106 $ this ->assertTrue ($ this ->model ->exists );
107107
108108 $ this ->model ->multipoint = new \Grimzy \LaravelMysqlSpatial \Types \MultiPoint ([$ point1 , $ point2 ]);
109109 $ this ->model ->save ();
110110
111111 $ this ->assertStringStartsWith ('update ' , $ this ->queries [1 ]);
112- $ this ->assertContains ("GeomFromText ('MULTIPOINT((2 1),(3 2))') " , $ this ->queries [1 ]);
112+ $ this ->assertContains ("ST_GeomFromText ('MULTIPOINT((2 1),(3 2))') " , $ this ->queries [1 ]);
113113 }
114114
115115 public function testInsertUpdateMultiLineStringHasCorrectSql ()
@@ -127,13 +127,13 @@ public function testInsertUpdateMultiLineStringHasCorrectSql()
127127 $ this ->model ->save ();
128128
129129 $ this ->assertStringStartsWith ('insert ' , $ this ->queries [0 ]);
130- $ this ->assertContains ("GeomFromText ('MULTILINESTRING((2 1,3 2),(2 3,1 2))') " , $ this ->queries [0 ]);
130+ $ this ->assertContains ("ST_GeomFromText ('MULTILINESTRING((2 1,3 2),(2 3,1 2))') " , $ this ->queries [0 ]);
131131 $ this ->assertTrue ($ this ->model ->exists );
132132
133133 $ this ->model ->multilinestring = new \Grimzy \LaravelMysqlSpatial \Types \MultiLineString ([$ linestring1 , $ linestring2 ]);
134134 $ this ->model ->save ();
135135 $ this ->assertStringStartsWith ('update ' , $ this ->queries [1 ]);
136- $ this ->assertContains ("GeomFromText ('MULTILINESTRING((2 1,3 2),(2 3,1 2))') " , $ this ->queries [1 ]);
136+ $ this ->assertContains ("ST_GeomFromText ('MULTILINESTRING((2 1,3 2),(2 3,1 2))') " , $ this ->queries [1 ]);
137137 }
138138
139139 public function testInsertUpdateMultiPolygonHasCorrectSql ()
@@ -160,13 +160,13 @@ public function testInsertUpdateMultiPolygonHasCorrectSql()
160160 $ this ->model ->save ();
161161
162162 $ this ->assertStringStartsWith ('insert ' , $ this ->queries [0 ]);
163- $ this ->assertContains ("GeomFromText ('MULTIPOLYGON(((2 1,3 2),(2 3,1 2)),((5 4,6 5),(5 6,4 5)))') " , $ this ->queries [0 ]);
163+ $ this ->assertContains ("ST_GeomFromText ('MULTIPOLYGON(((2 1,3 2),(2 3,1 2)),((5 4,6 5),(5 6,4 5)))') " , $ this ->queries [0 ]);
164164 $ this ->assertTrue ($ this ->model ->exists );
165165
166166 $ this ->model ->multipolygon = new \Grimzy \LaravelMysqlSpatial \Types \MultiPolygon ([$ polygon1 , $ polygon2 ]);
167167 $ this ->model ->save ();
168168 $ this ->assertStringStartsWith ('update ' , $ this ->queries [1 ]);
169- $ this ->assertContains ("GeomFromText ('MULTIPOLYGON(((2 1,3 2),(2 3,1 2)),((5 4,6 5),(5 6,4 5)))') " , $ this ->queries [1 ]);
169+ $ this ->assertContains ("ST_GeomFromText ('MULTIPOLYGON(((2 1,3 2),(2 3,1 2)),((5 4,6 5),(5 6,4 5)))') " , $ this ->queries [1 ]);
170170 }
171171
172172 public function testInsertUpdateGeometryCollectionHasCorrectSql ()
@@ -182,13 +182,13 @@ public function testInsertUpdateGeometryCollectionHasCorrectSql()
182182 $ this ->model ->save ();
183183
184184 $ this ->assertStringStartsWith ('insert ' , $ this ->queries [0 ]);
185- $ this ->assertContains ("GeomFromText ('GEOMETRYCOLLECTION(POINT(2 1),LINESTRING(3 2,3 3))') " , $ this ->queries [0 ]);
185+ $ this ->assertContains ("ST_GeomFromText ('GEOMETRYCOLLECTION(POINT(2 1),LINESTRING(3 2,3 3))') " , $ this ->queries [0 ]);
186186 $ this ->assertTrue ($ this ->model ->exists );
187187
188188 $ this ->model ->geometrycollection = new \Grimzy \LaravelMysqlSpatial \Types \GeometryCollection ([$ point1 , $ linestring1 ]);
189189 $ this ->model ->save ();
190190 $ this ->assertStringStartsWith ('update ' , $ this ->queries [1 ]);
191- $ this ->assertContains ("GeomFromText ('GEOMETRYCOLLECTION(POINT(2 1),LINESTRING(3 2,3 3))') " , $ this ->queries [1 ]);
191+ $ this ->assertContains ("ST_GeomFromText ('GEOMETRYCOLLECTION(POINT(2 1),LINESTRING(3 2,3 3))') " , $ this ->queries [1 ]);
192192 }
193193
194194 public function testScopeDistance ()
@@ -199,7 +199,7 @@ public function testScopeDistance()
199199 $ this ->assertInstanceOf (\Grimzy \LaravelMysqlSpatial \Eloquent \Builder::class, $ query );
200200 $ q = $ query ->getQuery ();
201201 $ this ->assertNotEmpty ($ q ->wheres );
202- $ this ->assertContains ("st_distance(`point`, GeomFromText ('POINT(2 1)')) <= 10 " , $ q ->wheres [0 ]['sql ' ]);
202+ $ this ->assertContains ("st_distance(`point`, ST_GeomFromText ('POINT(2 1)')) <= 10 " , $ q ->wheres [0 ]['sql ' ]);
203203 }
204204
205205 public function testScopeDistanceExcludingSelf ()
@@ -210,8 +210,8 @@ public function testScopeDistanceExcludingSelf()
210210 $ this ->assertInstanceOf (\Grimzy \LaravelMysqlSpatial \Eloquent \Builder::class, $ query );
211211 $ q = $ query ->getQuery ();
212212 $ this ->assertNotEmpty ($ q ->wheres );
213- $ this ->assertContains ("st_distance(`point`, GeomFromText ('POINT(2 1)')) <= 10 " , $ q ->wheres [0 ]['sql ' ]);
214- $ this ->assertContains ("st_distance(`point`, GeomFromText ('POINT(2 1)')) != 0 " , $ q ->wheres [1 ]['sql ' ]);
213+ $ this ->assertContains ("st_distance(`point`, ST_GeomFromText ('POINT(2 1)')) <= 10 " , $ q ->wheres [0 ]['sql ' ]);
214+ $ this ->assertContains ("st_distance(`point`, ST_GeomFromText ('POINT(2 1)')) != 0 " , $ q ->wheres [1 ]['sql ' ]);
215215 }
216216
217217 public function testScopeDistanceSphere ()
@@ -222,7 +222,7 @@ public function testScopeDistanceSphere()
222222 $ this ->assertInstanceOf (\Grimzy \LaravelMysqlSpatial \Eloquent \Builder::class, $ query );
223223 $ q = $ query ->getQuery ();
224224 $ this ->assertNotEmpty ($ q ->wheres );
225- $ this ->assertContains ("st_distance_sphere(`point`, GeomFromText ('POINT(2 1)')) <= 10 " , $ q ->wheres [0 ]['sql ' ]);
225+ $ this ->assertContains ("st_distance_sphere(`point`, ST_GeomFromText ('POINT(2 1)')) <= 10 " , $ q ->wheres [0 ]['sql ' ]);
226226 }
227227
228228 public function testScopeDistanceSphereExcludingSelf ()
@@ -233,8 +233,8 @@ public function testScopeDistanceSphereExcludingSelf()
233233 $ this ->assertInstanceOf (\Grimzy \LaravelMysqlSpatial \Eloquent \Builder::class, $ query );
234234 $ q = $ query ->getQuery ();
235235 $ this ->assertNotEmpty ($ q ->wheres );
236- $ this ->assertContains ("st_distance_sphere(`point`, GeomFromText ('POINT(2 1)')) <= 10 " , $ q ->wheres [0 ]['sql ' ]);
237- $ this ->assertContains ("st_distance_sphere(`point`, GeomFromText ('POINT(2 1)')) != 0 " , $ q ->wheres [1 ]['sql ' ]);
236+ $ this ->assertContains ("st_distance_sphere(`point`, ST_GeomFromText ('POINT(2 1)')) <= 10 " , $ q ->wheres [0 ]['sql ' ]);
237+ $ this ->assertContains ("st_distance_sphere(`point`, ST_GeomFromText ('POINT(2 1)')) != 0 " , $ q ->wheres [1 ]['sql ' ]);
238238 }
239239
240240 public function testScopeDistanceValue ()
@@ -247,7 +247,7 @@ public function testScopeDistanceValue()
247247 $ this ->assertNotEmpty ($ q ->columns );
248248 $ this ->assertContains ("* " , $ q ->columns [0 ]);
249249 $ this ->assertInstanceOf (\Illuminate \Database \Query \Expression::class, $ q ->columns [1 ]);
250- $ this ->assertContains ("st_distance(`point`, GeomFromText ('POINT(2 1)')) as distance " , $ q ->columns [1 ]->getValue ());
250+ $ this ->assertContains ("st_distance(`point`, ST_GeomFromText ('POINT(2 1)')) as distance " , $ q ->columns [1 ]->getValue ());
251251 }
252252
253253 public function testScopeDistanceValueWithSelect ()
@@ -260,7 +260,7 @@ public function testScopeDistanceValueWithSelect()
260260 $ this ->assertNotEmpty ($ q ->columns );
261261 $ this ->assertContains ("some_column " , $ q ->columns [0 ]);
262262 $ this ->assertInstanceOf (\Illuminate \Database \Query \Expression::class, $ q ->columns [1 ]);
263- $ this ->assertContains ("st_distance(`point`, GeomFromText ('POINT(2 1)')) as distance " , $ q ->columns [1 ]->getValue ());
263+ $ this ->assertContains ("st_distance(`point`, ST_GeomFromText ('POINT(2 1)')) as distance " , $ q ->columns [1 ]->getValue ());
264264 }
265265
266266 public function testScopeDistanceSphereValue ()
@@ -273,7 +273,7 @@ public function testScopeDistanceSphereValue()
273273 $ this ->assertNotEmpty ($ q ->columns );
274274 $ this ->assertContains ("* " , $ q ->columns [0 ]);
275275 $ this ->assertInstanceOf (\Illuminate \Database \Query \Expression::class, $ q ->columns [1 ]);
276- $ this ->assertContains ("st_distance_sphere(`point`, GeomFromText ('POINT(2 1)')) as distance " , $ q ->columns [1 ]->getValue ());
276+ $ this ->assertContains ("st_distance_sphere(`point`, ST_GeomFromText ('POINT(2 1)')) as distance " , $ q ->columns [1 ]->getValue ());
277277 }
278278
279279 public function testScopeDistanceSphereValueWithSelect ()
@@ -286,7 +286,7 @@ public function testScopeDistanceSphereValueWithSelect()
286286 $ this ->assertNotEmpty ($ q ->columns );
287287 $ this ->assertContains ("some_column " , $ q ->columns [0 ]);
288288 $ this ->assertInstanceOf (\Illuminate \Database \Query \Expression::class, $ q ->columns [1 ]);
289- $ this ->assertContains ("st_distance_sphere(`point`, GeomFromText ('POINT(2 1)')) as distance " , $ q ->columns [1 ]->getValue ());
289+ $ this ->assertContains ("st_distance_sphere(`point`, ST_GeomFromText ('POINT(2 1)')) as distance " , $ q ->columns [1 ]->getValue ());
290290 }
291291
292292 private function buildTestPolygon (){
@@ -308,7 +308,7 @@ public function testScopeBounding()
308308 $ this ->assertInstanceOf (\Grimzy \LaravelMysqlSpatial \Eloquent \Builder::class, $ query );
309309 $ q = $ query ->getQuery ();
310310 $ this ->assertNotEmpty ($ q ->wheres );
311- $ this ->assertContains ("st_intersects(GeomFromText ('POLYGON((1 1,2 1),(2 1,2 2),(2 2,1 1))'), `point`) " , $ q ->wheres [0 ]['sql ' ]);
311+ $ this ->assertContains ("st_intersects(ST_GeomFromText ('POLYGON((1 1,2 1),(2 1,2 2),(2 2,1 1))'), `point`) " , $ q ->wheres [0 ]['sql ' ]);
312312 }
313313
314314 public function testScopeComparison ()
0 commit comments