@@ -37,14 +37,16 @@ public function testInsertUpdatePointHasCorrectSql()
3737 $ this ->model ->save ();
3838
3939 $ this ->assertStringStartsWith ('insert ' , $ this ->queries [0 ]);
40- $ this ->assertContains ("ST_GeomFromText('POINT(2 1)') " , $ this ->queries [0 ]);
40+ $ this ->assertContains ('insert into `test_models` (`point`) values (ST_GeomFromText(?)) ' , $ this ->queries [0 ]);
41+ // TODO: assert bindings in query
4142 $ this ->assertTrue ($ this ->model ->exists );
4243
4344 $ this ->model ->point = new Point (1 , 2 );
4445 $ this ->model ->save ();
4546
4647 $ this ->assertStringStartsWith ('update ' , $ this ->queries [1 ]);
47- $ this ->assertContains ("ST_GeomFromText('POINT(2 1)') " , $ this ->queries [1 ]);
48+ $ this ->assertContains ('update `test_models` set `point` = ST_GeomFromText(?) where `id` = ? ' , $ this ->queries [1 ]);
49+ // TODO: assert bindings in query
4850 }
4951
5052 public function testInsertUpdateLineStringHasCorrectSql ()
@@ -58,14 +60,16 @@ public function testInsertUpdateLineStringHasCorrectSql()
5860 $ this ->model ->save ();
5961
6062 $ this ->assertStringStartsWith ('insert ' , $ this ->queries [0 ]);
61- $ this ->assertContains ("ST_GeomFromText('LINESTRING(2 1,3 2)') " , $ this ->queries [0 ]);
63+ $ this ->assertContains ('insert into `test_models` (`linestring`) values (ST_GeomFromText(?)) ' , $ this ->queries [0 ]);
64+ // TODO: assert bindings in query
6265 $ this ->assertTrue ($ this ->model ->exists );
6366
6467 $ this ->model ->linestring = new \Grimzy \LaravelMysqlSpatial \Types \LineString ([$ point1 , $ point2 ]);
6568 $ this ->model ->save ();
6669
6770 $ this ->assertStringStartsWith ('update ' , $ this ->queries [1 ]);
68- $ this ->assertContains ("ST_GeomFromText('LINESTRING(2 1,3 2)') " , $ this ->queries [1 ]);
71+ $ this ->assertContains ('update `test_models` set `linestring` = ST_GeomFromText(?) where `id` = ? ' , $ this ->queries [1 ]);
72+ // TODO: assert bindings in query
6973 }
7074
7175 public function testInsertUpdatePolygonHasCorrectSql ()
@@ -83,13 +87,15 @@ public function testInsertUpdatePolygonHasCorrectSql()
8387 $ this ->model ->save ();
8488
8589 $ this ->assertStringStartsWith ('insert ' , $ this ->queries [0 ]);
86- $ this ->assertContains ("ST_GeomFromText('POLYGON((2 1,3 2),(2 3,1 2))') " , $ this ->queries [0 ]);
90+ $ this ->assertContains ('insert into `test_models` (`polygon`) values (ST_GeomFromText(?)) ' , $ this ->queries [0 ]);
91+ // TODO: assert bindings in query
8792 $ this ->assertTrue ($ this ->model ->exists );
8893
8994 $ this ->model ->polygon = new \Grimzy \LaravelMysqlSpatial \Types \Polygon ([$ linestring1 , $ linestring2 ]);
9095 $ this ->model ->save ();
9196 $ this ->assertStringStartsWith ('update ' , $ this ->queries [1 ]);
92- $ this ->assertContains ("ST_GeomFromText('POLYGON((2 1,3 2),(2 3,1 2))') " , $ this ->queries [1 ]);
97+ $ this ->assertContains ('update `test_models` set `polygon` = ST_GeomFromText(?) where `id` = ? ' , $ this ->queries [1 ]);
98+ // TODO: assert bindings in query
9399 }
94100
95101 public function testInsertUpdateMultiPointHasCorrectSql ()
@@ -103,14 +109,16 @@ public function testInsertUpdateMultiPointHasCorrectSql()
103109 $ this ->model ->save ();
104110
105111 $ this ->assertStringStartsWith ('insert ' , $ this ->queries [0 ]);
106- $ this ->assertContains ("ST_GeomFromText('MULTIPOINT((2 1),(3 2))') " , $ this ->queries [0 ]);
112+ $ this ->assertContains ('insert into `test_models` (`multipoint`) values (ST_GeomFromText(?)) ' , $ this ->queries [0 ]);
113+ // TODO: assert bindings in query
107114 $ this ->assertTrue ($ this ->model ->exists );
108115
109116 $ this ->model ->multipoint = new \Grimzy \LaravelMysqlSpatial \Types \MultiPoint ([$ point1 , $ point2 ]);
110117 $ this ->model ->save ();
111118
112119 $ this ->assertStringStartsWith ('update ' , $ this ->queries [1 ]);
113- $ this ->assertContains ("ST_GeomFromText('MULTIPOINT((2 1),(3 2))') " , $ this ->queries [1 ]);
120+ $ this ->assertContains ('update `test_models` set `multipoint` = ST_GeomFromText(?) where `id` = ? ' , $ this ->queries [1 ]);
121+ // TODO: assert bindings in query
114122 }
115123
116124 public function testInsertUpdateMultiLineStringHasCorrectSql ()
@@ -128,13 +136,15 @@ public function testInsertUpdateMultiLineStringHasCorrectSql()
128136 $ this ->model ->save ();
129137
130138 $ this ->assertStringStartsWith ('insert ' , $ this ->queries [0 ]);
131- $ this ->assertContains ("ST_GeomFromText('MULTILINESTRING((2 1,3 2),(2 3,1 2))') " , $ this ->queries [0 ]);
139+ $ this ->assertContains ('insert into `test_models` (`multilinestring`) values (ST_GeomFromText(?)) ' , $ this ->queries [0 ]);
140+ // TODO: assert bindings in query
132141 $ this ->assertTrue ($ this ->model ->exists );
133142
134143 $ this ->model ->multilinestring = new \Grimzy \LaravelMysqlSpatial \Types \MultiLineString ([$ linestring1 , $ linestring2 ]);
135144 $ this ->model ->save ();
136145 $ this ->assertStringStartsWith ('update ' , $ this ->queries [1 ]);
137- $ this ->assertContains ("ST_GeomFromText('MULTILINESTRING((2 1,3 2),(2 3,1 2))') " , $ this ->queries [1 ]);
146+ $ this ->assertContains ('update `test_models` set `multilinestring` = ST_GeomFromText(?) where `id` = ? ' , $ this ->queries [1 ]);
147+ // TODO: assert bindings in query
138148 }
139149
140150 public function testInsertUpdateMultiPolygonHasCorrectSql ()
@@ -161,13 +171,15 @@ public function testInsertUpdateMultiPolygonHasCorrectSql()
161171 $ this ->model ->save ();
162172
163173 $ this ->assertStringStartsWith ('insert ' , $ this ->queries [0 ]);
164- $ this ->assertContains ("ST_GeomFromText('MULTIPOLYGON(((2 1,3 2),(2 3,1 2)),((5 4,6 5),(5 6,4 5)))') " , $ this ->queries [0 ]);
174+ $ this ->assertContains ('insert into `test_models` (`multipolygon`) values (ST_GeomFromText(?)) ' , $ this ->queries [0 ]);
175+ // TODO: assert bindings in query
165176 $ this ->assertTrue ($ this ->model ->exists );
166177
167178 $ this ->model ->multipolygon = new \Grimzy \LaravelMysqlSpatial \Types \MultiPolygon ([$ polygon1 , $ polygon2 ]);
168179 $ this ->model ->save ();
169180 $ this ->assertStringStartsWith ('update ' , $ this ->queries [1 ]);
170- $ this ->assertContains ("ST_GeomFromText('MULTIPOLYGON(((2 1,3 2),(2 3,1 2)),((5 4,6 5),(5 6,4 5)))') " , $ this ->queries [1 ]);
181+ $ this ->assertContains ('update `test_models` set `multipolygon` = ST_GeomFromText(?) where `id` = ? ' , $ this ->queries [1 ]);
182+ // TODO: assert bindings in query
171183 }
172184
173185 public function testInsertUpdateGeometryCollectionHasCorrectSql ()
@@ -183,13 +195,15 @@ public function testInsertUpdateGeometryCollectionHasCorrectSql()
183195 $ this ->model ->save ();
184196
185197 $ this ->assertStringStartsWith ('insert ' , $ this ->queries [0 ]);
186- $ this ->assertContains ("ST_GeomFromText('GEOMETRYCOLLECTION(POINT(2 1),LINESTRING(3 2,3 3))') " , $ this ->queries [0 ]);
198+ $ this ->assertContains ('insert into `test_models` (`geometrycollection`) values (ST_GeomFromText(?)) ' , $ this ->queries [0 ]);
199+ // TODO: assert bindings in query
187200 $ this ->assertTrue ($ this ->model ->exists );
188201
189202 $ this ->model ->geometrycollection = new \Grimzy \LaravelMysqlSpatial \Types \GeometryCollection ([$ point1 , $ linestring1 ]);
190203 $ this ->model ->save ();
191204 $ this ->assertStringStartsWith ('update ' , $ this ->queries [1 ]);
192- $ this ->assertContains ("ST_GeomFromText('GEOMETRYCOLLECTION(POINT(2 1),LINESTRING(3 2,3 3))') " , $ this ->queries [1 ]);
205+ $ this ->assertContains ('update `test_models` set `geometrycollection` = ST_GeomFromText(?) where `id` = ? ' , $ this ->queries [1 ]);
206+ // TODO: assert bindings in query
193207 }
194208
195209 public function testSettingRawAttributes ()
0 commit comments