From 99ac822a092e44a5f3274bcff5cd44590ef4bbd1 Mon Sep 17 00:00:00 2001 From: Eugene Date: Tue, 13 Oct 2020 15:05:19 +0500 Subject: [PATCH 1/3] Update SpatialExpression.php --- src/Eloquent/SpatialExpression.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Eloquent/SpatialExpression.php b/src/Eloquent/SpatialExpression.php index 9224af0f..bb598851 100644 --- a/src/Eloquent/SpatialExpression.php +++ b/src/Eloquent/SpatialExpression.php @@ -8,7 +8,7 @@ class SpatialExpression extends Expression { public function getValue() { - return "ST_GeomFromText(?, ?, 'axis-order=long-lat')"; + return "ST_GeomFromText(?, ?)"; } public function getSpatialValue() From 4a80138521bc72ea17db19103ca882922bebae5c Mon Sep 17 00:00:00 2001 From: Eugene Date: Sat, 17 Oct 2020 14:55:57 +0500 Subject: [PATCH 2/3] Update composer.json --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 4451cb50..a5d443e7 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "grimzy/laravel-mysql-spatial", + "name": "deprecator/laravel-mysql-spatial", "description": "MySQL spatial data types extension for Laravel.", "scripts": { "test": "phpunit -c phpunit.xml.dist", @@ -31,7 +31,7 @@ }, "autoload": { "psr-4": { - "Grimzy\\LaravelMysqlSpatial\\": "src/" + "Deprecator\\LaravelMysqlSpatial\\": "src/" } }, "autoload-dev" : { From 9068347a46d7844a4c35257d5d776fa9634b6608 Mon Sep 17 00:00:00 2001 From: Deprecator Date: Sat, 17 Oct 2020 16:52:09 +0500 Subject: [PATCH 3/3] fixed namespaces --- composer.json | 2 +- src/Connectors/ConnectionFactory.php | 4 +- src/Doctrine/Geometry.php | 2 +- src/Doctrine/GeometryCollection.php | 2 +- src/Doctrine/LineString.php | 2 +- src/Doctrine/MultiLineString.php | 2 +- src/Doctrine/MultiPoint.php | 2 +- src/Doctrine/MultiPolygon.php | 2 +- src/Doctrine/Point.php | 2 +- src/Doctrine/Polygon.php | 2 +- src/Eloquent/BaseBuilder.php | 2 +- src/Eloquent/Builder.php | 4 +- src/Eloquent/SpatialExpression.php | 2 +- src/Eloquent/SpatialTrait.php | 14 +-- src/Exceptions/InvalidGeoJsonException.php | 2 +- .../SpatialFieldsNotDefinedException.php | 2 +- .../UnknownSpatialFunctionException.php | 2 +- .../UnknownSpatialRelationFunction.php | 2 +- src/Exceptions/UnknownWKTTypeException.php | 2 +- src/MysqlConnection.php | 6 +- src/Schema/Blueprint.php | 2 +- src/Schema/Builder.php | 2 +- src/Schema/Grammars/MySqlGrammar.php | 4 +- src/SpatialServiceProvider.php | 20 ++-- src/Types/Factory.php | 2 +- src/Types/Geometry.php | 6 +- src/Types/GeometryCollection.php | 4 +- src/Types/GeometryInterface.php | 2 +- src/Types/LineString.php | 4 +- src/Types/MultiLineString.php | 4 +- src/Types/MultiPoint.php | 4 +- src/Types/MultiPolygon.php | 4 +- src/Types/Point.php | 6 +- src/Types/PointCollection.php | 10 +- src/Types/Polygon.php | 4 +- tests/Integration/IntegrationBaseTestCase.php | 2 +- tests/Integration/Migrations/CreateTables.php | 2 +- tests/Integration/Migrations/UpdateTables.php | 2 +- tests/Integration/Models/GeometryModel.php | 8 +- .../Models/NoSpatialFieldsModel.php | 4 +- tests/Integration/Models/WithSridModel.php | 8 +- tests/Integration/SpatialTest.php | 22 ++-- tests/Integration/SridSpatialTest.php | 12 +- .../Unit/Connectors/ConnectionFactoryTest.php | 4 +- tests/Unit/Eloquent/BuilderTest.php | 14 +-- tests/Unit/Eloquent/SpatialTraitTest.php | 104 +++++++++--------- tests/Unit/MysqlConnectionTest.php | 4 +- tests/Unit/Schema/BlueprintTest.php | 4 +- tests/Unit/Schema/BuilderTest.php | 6 +- .../Unit/Schema/Grammars/MySqlGrammarTest.php | 6 +- tests/Unit/Types/GeometryCollectionTest.php | 16 +-- tests/Unit/Types/GeometryTest.php | 18 +-- tests/Unit/Types/LineStringTest.php | 6 +- tests/Unit/Types/MultiLineStringTest.php | 14 +-- tests/Unit/Types/MultiPointTest.php | 12 +- tests/Unit/Types/MultiPolygonTest.php | 16 +-- tests/Unit/Types/PointTest.php | 4 +- tests/Unit/Types/PolygonTest.php | 8 +- 58 files changed, 217 insertions(+), 217 deletions(-) diff --git a/composer.json b/composer.json index a5d443e7..7213c2ab 100644 --- a/composer.json +++ b/composer.json @@ -46,7 +46,7 @@ }, "laravel": { "providers": [ - "Grimzy\\LaravelMysqlSpatial\\SpatialServiceProvider" + "Deprecator\\LaravelMysqlSpatial\\SpatialServiceProvider" ] } } diff --git a/src/Connectors/ConnectionFactory.php b/src/Connectors/ConnectionFactory.php index 223cea13..d92eb9bc 100644 --- a/src/Connectors/ConnectionFactory.php +++ b/src/Connectors/ConnectionFactory.php @@ -1,8 +1,8 @@ getGeometry(); } - $type = '\Grimzy\LaravelMysqlSpatial\Types\\'.$geoJson->getType(); + $type = '\Deprecator\LaravelMysqlSpatial\Types\\'.$geoJson->getType(); return $type::fromJson($geoJson); } diff --git a/src/Types/GeometryCollection.php b/src/Types/GeometryCollection.php index 35f093f7..fb06997e 100755 --- a/src/Types/GeometryCollection.php +++ b/src/Types/GeometryCollection.php @@ -1,13 +1,13 @@ geometry = new Point(1, 2); $geo->save(); - $this->assertException(\Grimzy\LaravelMysqlSpatial\Exceptions\SpatialFieldsNotDefinedException::class); + $this->assertException(\Deprecator\LaravelMysqlSpatial\Exceptions\SpatialFieldsNotDefinedException::class); NoSpatialFieldsModel::all(); } @@ -241,7 +241,7 @@ public function testOrderBySpatialWithUnknownFunction() $loc = new GeometryModel(); $loc->location = new Point(1, 1); - $this->assertException(\Grimzy\LaravelMysqlSpatial\Exceptions\UnknownSpatialFunctionException::class); + $this->assertException(\Deprecator\LaravelMysqlSpatial\Exceptions\UnknownSpatialFunctionException::class); GeometryModel::orderBySpatial('location', $loc->location, 'does-not-exist')->get(); } @@ -315,9 +315,9 @@ public function testOrderByDistanceSphere() //public function testBounding() { // $point = new Point(0, 0); // - // $linestring1 = \Grimzy\LaravelMysqlSpatial\Types\LineString::fromWkt("LINESTRING(1 1, 2 2)"); - // $linestring2 = \Grimzy\LaravelMysqlSpatial\Types\LineString::fromWkt("LINESTRING(20 20, 24 24)"); - // $linestring3 = \Grimzy\LaravelMysqlSpatial\Types\LineString::fromWkt("LINESTRING(0 10, 10 10)"); + // $linestring1 = \Deprecator\LaravelMysqlSpatial\Types\LineString::fromWkt("LINESTRING(1 1, 2 2)"); + // $linestring2 = \Deprecator\LaravelMysqlSpatial\Types\LineString::fromWkt("LINESTRING(20 20, 24 24)"); + // $linestring3 = \Deprecator\LaravelMysqlSpatial\Types\LineString::fromWkt("LINESTRING(0 10, 10 10)"); // // $geo1 = new GeometryModel(); // $geo1->location = $point; diff --git a/tests/Integration/SridSpatialTest.php b/tests/Integration/SridSpatialTest.php index f57c6cb2..b54576a8 100644 --- a/tests/Integration/SridSpatialTest.php +++ b/tests/Integration/SridSpatialTest.php @@ -1,11 +1,11 @@ assertFalse($this->model->exists); - $this->model->linestring = new \Grimzy\LaravelMysqlSpatial\Types\LineString([$point1, $point2]); + $this->model->linestring = new \Deprecator\LaravelMysqlSpatial\Types\LineString([$point1, $point2]); $this->model->save(); $this->assertStringStartsWith('insert', $this->queries[0]); @@ -67,7 +67,7 @@ public function testInsertUpdateLineStringHasCorrectSql() // TODO: assert bindings in query $this->assertTrue($this->model->exists); - $this->model->linestring = new \Grimzy\LaravelMysqlSpatial\Types\LineString([$point1, $point2]); + $this->model->linestring = new \Deprecator\LaravelMysqlSpatial\Types\LineString([$point1, $point2]); $this->model->save(); $this->assertStringStartsWith('update', $this->queries[1]); @@ -79,14 +79,14 @@ public function testInsertUpdatePolygonHasCorrectSql() { $point1 = new Point(1, 2); $point2 = new Point(2, 3); - $linestring1 = new \Grimzy\LaravelMysqlSpatial\Types\LineString([$point1, $point2]); + $linestring1 = new \Deprecator\LaravelMysqlSpatial\Types\LineString([$point1, $point2]); $point3 = new Point(3, 2); $point4 = new Point(2, 1); - $linestring2 = new \Grimzy\LaravelMysqlSpatial\Types\LineString([$point3, $point4]); + $linestring2 = new \Deprecator\LaravelMysqlSpatial\Types\LineString([$point3, $point4]); $this->assertFalse($this->model->exists); - $this->model->polygon = new \Grimzy\LaravelMysqlSpatial\Types\Polygon([$linestring1, $linestring2]); + $this->model->polygon = new \Deprecator\LaravelMysqlSpatial\Types\Polygon([$linestring1, $linestring2]); $this->model->save(); $this->assertStringStartsWith('insert', $this->queries[0]); @@ -94,7 +94,7 @@ public function testInsertUpdatePolygonHasCorrectSql() // TODO: assert bindings in query $this->assertTrue($this->model->exists); - $this->model->polygon = new \Grimzy\LaravelMysqlSpatial\Types\Polygon([$linestring1, $linestring2]); + $this->model->polygon = new \Deprecator\LaravelMysqlSpatial\Types\Polygon([$linestring1, $linestring2]); $this->model->save(); $this->assertStringStartsWith('update', $this->queries[1]); $this->assertContains('update `test_models` set `polygon` = ST_GeomFromText(?, ?, \'axis-order=long-lat\') where `id` = ?', $this->queries[1]); @@ -108,7 +108,7 @@ public function testInsertUpdateMultiPointHasCorrectSql() $this->assertFalse($this->model->exists); - $this->model->multipoint = new \Grimzy\LaravelMysqlSpatial\Types\MultiPoint([$point1, $point2]); + $this->model->multipoint = new \Deprecator\LaravelMysqlSpatial\Types\MultiPoint([$point1, $point2]); $this->model->save(); $this->assertStringStartsWith('insert', $this->queries[0]); @@ -116,7 +116,7 @@ public function testInsertUpdateMultiPointHasCorrectSql() // TODO: assert bindings in query $this->assertTrue($this->model->exists); - $this->model->multipoint = new \Grimzy\LaravelMysqlSpatial\Types\MultiPoint([$point1, $point2]); + $this->model->multipoint = new \Deprecator\LaravelMysqlSpatial\Types\MultiPoint([$point1, $point2]); $this->model->save(); $this->assertStringStartsWith('update', $this->queries[1]); @@ -128,14 +128,14 @@ public function testInsertUpdateMultiLineStringHasCorrectSql() { $point1 = new Point(1, 2); $point2 = new Point(2, 3); - $linestring1 = new \Grimzy\LaravelMysqlSpatial\Types\LineString([$point1, $point2]); + $linestring1 = new \Deprecator\LaravelMysqlSpatial\Types\LineString([$point1, $point2]); $point3 = new Point(3, 2); $point4 = new Point(2, 1); - $linestring2 = new \Grimzy\LaravelMysqlSpatial\Types\LineString([$point3, $point4]); + $linestring2 = new \Deprecator\LaravelMysqlSpatial\Types\LineString([$point3, $point4]); $this->assertFalse($this->model->exists); - $this->model->multilinestring = new \Grimzy\LaravelMysqlSpatial\Types\MultiLineString([$linestring1, $linestring2]); + $this->model->multilinestring = new \Deprecator\LaravelMysqlSpatial\Types\MultiLineString([$linestring1, $linestring2]); $this->model->save(); $this->assertStringStartsWith('insert', $this->queries[0]); @@ -143,7 +143,7 @@ public function testInsertUpdateMultiLineStringHasCorrectSql() // TODO: assert bindings in query $this->assertTrue($this->model->exists); - $this->model->multilinestring = new \Grimzy\LaravelMysqlSpatial\Types\MultiLineString([$linestring1, $linestring2]); + $this->model->multilinestring = new \Deprecator\LaravelMysqlSpatial\Types\MultiLineString([$linestring1, $linestring2]); $this->model->save(); $this->assertStringStartsWith('update', $this->queries[1]); $this->assertContains('update `test_models` set `multilinestring` = ST_GeomFromText(?, ?, \'axis-order=long-lat\') where `id` = ?', $this->queries[1]); @@ -154,23 +154,23 @@ public function testInsertUpdateMultiPolygonHasCorrectSql() { $point1 = new Point(1, 2); $point2 = new Point(2, 3); - $linestring1 = new \Grimzy\LaravelMysqlSpatial\Types\LineString([$point1, $point2]); + $linestring1 = new \Deprecator\LaravelMysqlSpatial\Types\LineString([$point1, $point2]); $point3 = new Point(3, 2); $point4 = new Point(2, 1); - $linestring2 = new \Grimzy\LaravelMysqlSpatial\Types\LineString([$point3, $point4]); - $polygon1 = new \Grimzy\LaravelMysqlSpatial\Types\Polygon([$linestring1, $linestring2]); + $linestring2 = new \Deprecator\LaravelMysqlSpatial\Types\LineString([$point3, $point4]); + $polygon1 = new \Deprecator\LaravelMysqlSpatial\Types\Polygon([$linestring1, $linestring2]); $point5 = new Point(4, 5); $point6 = new Point(5, 6); - $linestring3 = new \Grimzy\LaravelMysqlSpatial\Types\LineString([$point5, $point6]); + $linestring3 = new \Deprecator\LaravelMysqlSpatial\Types\LineString([$point5, $point6]); $point7 = new Point(6, 5); $point8 = new Point(5, 4); - $linestring4 = new \Grimzy\LaravelMysqlSpatial\Types\LineString([$point7, $point8]); - $polygon2 = new \Grimzy\LaravelMysqlSpatial\Types\Polygon([$linestring3, $linestring4]); + $linestring4 = new \Deprecator\LaravelMysqlSpatial\Types\LineString([$point7, $point8]); + $polygon2 = new \Deprecator\LaravelMysqlSpatial\Types\Polygon([$linestring3, $linestring4]); $this->assertFalse($this->model->exists); - $this->model->multipolygon = new \Grimzy\LaravelMysqlSpatial\Types\MultiPolygon([$polygon1, $polygon2]); + $this->model->multipolygon = new \Deprecator\LaravelMysqlSpatial\Types\MultiPolygon([$polygon1, $polygon2]); $this->model->save(); $this->assertStringStartsWith('insert', $this->queries[0]); @@ -178,7 +178,7 @@ public function testInsertUpdateMultiPolygonHasCorrectSql() // TODO: assert bindings in query $this->assertTrue($this->model->exists); - $this->model->multipolygon = new \Grimzy\LaravelMysqlSpatial\Types\MultiPolygon([$polygon1, $polygon2]); + $this->model->multipolygon = new \Deprecator\LaravelMysqlSpatial\Types\MultiPolygon([$polygon1, $polygon2]); $this->model->save(); $this->assertStringStartsWith('update', $this->queries[1]); $this->assertContains('update `test_models` set `multipolygon` = ST_GeomFromText(?, ?, \'axis-order=long-lat\') where `id` = ?', $this->queries[1]); @@ -190,11 +190,11 @@ public function testInsertUpdateGeometryCollectionHasCorrectSql() $point1 = new Point(1, 2); $point2 = new Point(2, 3); $point3 = new Point(3, 3); - $linestring1 = new \Grimzy\LaravelMysqlSpatial\Types\LineString([$point2, $point3]); + $linestring1 = new \Deprecator\LaravelMysqlSpatial\Types\LineString([$point2, $point3]); $this->assertFalse($this->model->exists); - $this->model->geometrycollection = new \Grimzy\LaravelMysqlSpatial\Types\GeometryCollection([$point1, $linestring1]); + $this->model->geometrycollection = new \Deprecator\LaravelMysqlSpatial\Types\GeometryCollection([$point1, $linestring1]); $this->model->save(); $this->assertStringStartsWith('insert', $this->queries[0]); @@ -202,7 +202,7 @@ public function testInsertUpdateGeometryCollectionHasCorrectSql() // TODO: assert bindings in query $this->assertTrue($this->model->exists); - $this->model->geometrycollection = new \Grimzy\LaravelMysqlSpatial\Types\GeometryCollection([$point1, $linestring1]); + $this->model->geometrycollection = new \Deprecator\LaravelMysqlSpatial\Types\GeometryCollection([$point1, $linestring1]); $this->model->save(); $this->assertStringStartsWith('update', $this->queries[1]); $this->assertContains('update `test_models` set `geometrycollection` = ST_GeomFromText(?, ?, \'axis-order=long-lat\') where `id` = ?', $this->queries[1]); @@ -232,7 +232,7 @@ public function testScopeDistance() $point = new Point(1, 2); $query = TestModel::distance('point', $point, 10); - $this->assertInstanceOf(\Grimzy\LaravelMysqlSpatial\Eloquent\Builder::class, $query); + $this->assertInstanceOf(\Deprecator\LaravelMysqlSpatial\Eloquent\Builder::class, $query); $q = $query->getQuery(); $this->assertNotEmpty($q->wheres); $bindings = $q->getRawBindings()['where']; @@ -247,7 +247,7 @@ public function testScopeDistanceExcludingSelf() $point = new Point(1, 2); $query = TestModel::distanceExcludingSelf('point', $point, 10); - $this->assertInstanceOf(\Grimzy\LaravelMysqlSpatial\Eloquent\Builder::class, $query); + $this->assertInstanceOf(\Deprecator\LaravelMysqlSpatial\Eloquent\Builder::class, $query); $q = $query->getQuery(); $this->assertNotEmpty($q->wheres); $bindings = $q->getRawBindings()['where']; @@ -264,7 +264,7 @@ public function testScopeDistanceSphere() $point = new Point(1, 2); $query = TestModel::distanceSphere('point', $point, 10); - $this->assertInstanceOf(\Grimzy\LaravelMysqlSpatial\Eloquent\Builder::class, $query); + $this->assertInstanceOf(\Deprecator\LaravelMysqlSpatial\Eloquent\Builder::class, $query); $q = $query->getQuery(); $this->assertNotEmpty($q->wheres); $bindings = $q->getRawBindings()['where']; @@ -279,7 +279,7 @@ public function testScopeDistanceSphereExcludingSelf() $point = new Point(1, 2); $query = TestModel::distanceSphereExcludingSelf('point', $point, 10); - $this->assertInstanceOf(\Grimzy\LaravelMysqlSpatial\Eloquent\Builder::class, $query); + $this->assertInstanceOf(\Deprecator\LaravelMysqlSpatial\Eloquent\Builder::class, $query); $q = $query->getQuery(); $this->assertNotEmpty($q->wheres); $bindings = $q->getRawBindings()['where']; @@ -296,7 +296,7 @@ public function testScopeDistanceValue() $point = new Point(1, 2); $query = TestModel::distanceValue('point', $point); - $this->assertInstanceOf(\Grimzy\LaravelMysqlSpatial\Eloquent\Builder::class, $query); + $this->assertInstanceOf(\Deprecator\LaravelMysqlSpatial\Eloquent\Builder::class, $query); $q = $query->getQuery(); $this->assertNotEmpty($q->columns); $bindings = $q->getRawBindings()['select']; @@ -312,7 +312,7 @@ public function testScopeDistanceValueWithSelect() $point = new Point(1, 2); $query = TestModel::select('some_column')->distanceValue('point', $point); - $this->assertInstanceOf(\Grimzy\LaravelMysqlSpatial\Eloquent\Builder::class, $query); + $this->assertInstanceOf(\Deprecator\LaravelMysqlSpatial\Eloquent\Builder::class, $query); $q = $query->getQuery(); $this->assertNotEmpty($q->columns); $bindings = $q->getRawBindings()['select']; @@ -328,7 +328,7 @@ public function testScopeDistanceSphereValue() $point = new Point(1, 2); $query = TestModel::distanceSphereValue('point', $point); - $this->assertInstanceOf(\Grimzy\LaravelMysqlSpatial\Eloquent\Builder::class, $query); + $this->assertInstanceOf(\Deprecator\LaravelMysqlSpatial\Eloquent\Builder::class, $query); $q = $query->getQuery(); $this->assertNotEmpty($q->columns); $bindings = $q->getRawBindings()['select']; @@ -344,7 +344,7 @@ public function testScopeDistanceSphereValueWithSelect() $point = new Point(1, 2); $query = TestModel::select('some_column')->distanceSphereValue('point', $point); - $this->assertInstanceOf(\Grimzy\LaravelMysqlSpatial\Eloquent\Builder::class, $query); + $this->assertInstanceOf(\Deprecator\LaravelMysqlSpatial\Eloquent\Builder::class, $query); $q = $query->getQuery(); $this->assertNotEmpty($q->columns); $bindings = $q->getRawBindings()['select']; @@ -359,22 +359,22 @@ private function buildTestPolygon() { $point1 = new Point(1, 1); $point2 = new Point(1, 2); - $linestring1 = new \Grimzy\LaravelMysqlSpatial\Types\LineString([$point1, $point2]); + $linestring1 = new \Deprecator\LaravelMysqlSpatial\Types\LineString([$point1, $point2]); $point3 = new Point(1, 2); $point4 = new Point(2, 2); - $linestring2 = new \Grimzy\LaravelMysqlSpatial\Types\LineString([$point3, $point4]); + $linestring2 = new \Deprecator\LaravelMysqlSpatial\Types\LineString([$point3, $point4]); $point5 = new Point(2, 2); $point6 = new Point(1, 1); - $linestring3 = new \Grimzy\LaravelMysqlSpatial\Types\LineString([$point5, $point6]); + $linestring3 = new \Deprecator\LaravelMysqlSpatial\Types\LineString([$point5, $point6]); - return new \Grimzy\LaravelMysqlSpatial\Types\Polygon([$linestring1, $linestring2, $linestring3]); + return new \Deprecator\LaravelMysqlSpatial\Types\Polygon([$linestring1, $linestring2, $linestring3]); } public function testScopeComparison() { $query = TestModel::comparison('point', $this->buildTestPolygon(), 'within'); - $this->assertInstanceOf(\Grimzy\LaravelMysqlSpatial\Eloquent\Builder::class, $query); + $this->assertInstanceOf(\Deprecator\LaravelMysqlSpatial\Eloquent\Builder::class, $query); $q = $query->getQuery(); $this->assertNotEmpty($q->wheres); $bindings = $q->getRawBindings()['where']; @@ -387,7 +387,7 @@ public function testScopeWithin() { $query = TestModel::within('point', $this->buildTestPolygon()); - $this->assertInstanceOf(\Grimzy\LaravelMysqlSpatial\Eloquent\Builder::class, $query); + $this->assertInstanceOf(\Deprecator\LaravelMysqlSpatial\Eloquent\Builder::class, $query); $q = $query->getQuery(); $this->assertNotEmpty($q->wheres); $bindings = $q->getRawBindings()['where']; @@ -400,7 +400,7 @@ public function testScopeCrosses() { $query = TestModel::crosses('point', $this->buildTestPolygon()); - $this->assertInstanceOf(\Grimzy\LaravelMysqlSpatial\Eloquent\Builder::class, $query); + $this->assertInstanceOf(\Deprecator\LaravelMysqlSpatial\Eloquent\Builder::class, $query); $q = $query->getQuery(); $this->assertNotEmpty($q->wheres); $bindings = $q->getRawBindings()['where']; @@ -413,7 +413,7 @@ public function testScopeContains() { $query = TestModel::contains('point', $this->buildTestPolygon()); - $this->assertInstanceOf(\Grimzy\LaravelMysqlSpatial\Eloquent\Builder::class, $query); + $this->assertInstanceOf(\Deprecator\LaravelMysqlSpatial\Eloquent\Builder::class, $query); $q = $query->getQuery(); $this->assertNotEmpty($q->wheres); $bindings = $q->getRawBindings()['where']; @@ -426,7 +426,7 @@ public function testScopeDisjoint() { $query = TestModel::disjoint('point', $this->buildTestPolygon()); - $this->assertInstanceOf(\Grimzy\LaravelMysqlSpatial\Eloquent\Builder::class, $query); + $this->assertInstanceOf(\Deprecator\LaravelMysqlSpatial\Eloquent\Builder::class, $query); $q = $query->getQuery(); $this->assertNotEmpty($q->wheres); $bindings = $q->getRawBindings()['where']; @@ -439,7 +439,7 @@ public function testScopeEquals() { $query = TestModel::equals('point', $this->buildTestPolygon()); - $this->assertInstanceOf(\Grimzy\LaravelMysqlSpatial\Eloquent\Builder::class, $query); + $this->assertInstanceOf(\Deprecator\LaravelMysqlSpatial\Eloquent\Builder::class, $query); $q = $query->getQuery(); $this->assertNotEmpty($q->wheres); $bindings = $q->getRawBindings()['where']; @@ -452,7 +452,7 @@ public function testScopeIntersects() { $query = TestModel::intersects('point', $this->buildTestPolygon()); - $this->assertInstanceOf(\Grimzy\LaravelMysqlSpatial\Eloquent\Builder::class, $query); + $this->assertInstanceOf(\Deprecator\LaravelMysqlSpatial\Eloquent\Builder::class, $query); $q = $query->getQuery(); $this->assertNotEmpty($q->wheres); $bindings = $q->getRawBindings()['where']; @@ -465,7 +465,7 @@ public function testScopeOverlaps() { $query = TestModel::overlaps('point', $this->buildTestPolygon()); - $this->assertInstanceOf(\Grimzy\LaravelMysqlSpatial\Eloquent\Builder::class, $query); + $this->assertInstanceOf(\Deprecator\LaravelMysqlSpatial\Eloquent\Builder::class, $query); $q = $query->getQuery(); $this->assertNotEmpty($q->wheres); $bindings = $q->getRawBindings()['where']; @@ -478,7 +478,7 @@ public function testScopeDoesTouch() { $query = TestModel::doesTouch('point', $this->buildTestPolygon()); - $this->assertInstanceOf(\Grimzy\LaravelMysqlSpatial\Eloquent\Builder::class, $query); + $this->assertInstanceOf(\Deprecator\LaravelMysqlSpatial\Eloquent\Builder::class, $query); $q = $query->getQuery(); $this->assertNotEmpty($q->wheres); $bindings = $q->getRawBindings()['where']; @@ -491,7 +491,7 @@ public function testScopeOrderBySpatialThrowsExceptionWhenFunctionNotRegistered( { $point = new Point(1, 2); $this->assertException( - \Grimzy\LaravelMysqlSpatial\Exceptions\UnknownSpatialFunctionException::class, + \Deprecator\LaravelMysqlSpatial\Exceptions\UnknownSpatialFunctionException::class, 'does-not-exist' ); TestModel::orderBySpatial('point', $point, 'does-not-exist'); @@ -502,7 +502,7 @@ public function testScopeOrderByDistance() $point = new Point(1, 2); $query = TestModel::orderByDistance('point', $point); - $this->assertInstanceOf(\Grimzy\LaravelMysqlSpatial\Eloquent\Builder::class, $query); + $this->assertInstanceOf(\Deprecator\LaravelMysqlSpatial\Eloquent\Builder::class, $query); $q = $query->getQuery(); $this->assertNotEmpty($q->orders); $bindings = $q->getRawBindings()['order']; @@ -516,7 +516,7 @@ public function testScopeOrderByDistanceSphere() $point = new Point(1, 2); $query = TestModel::orderByDistanceSphere('point', $point); - $this->assertInstanceOf(\Grimzy\LaravelMysqlSpatial\Eloquent\Builder::class, $query); + $this->assertInstanceOf(\Deprecator\LaravelMysqlSpatial\Eloquent\Builder::class, $query); $q = $query->getQuery(); $this->assertNotEmpty($q->orders); $bindings = $q->getRawBindings()['order']; @@ -528,7 +528,7 @@ public function testScopeOrderByDistanceSphere() class TestModel extends Model { - use \Grimzy\LaravelMysqlSpatial\Eloquent\SpatialTrait; + use \Deprecator\LaravelMysqlSpatial\Eloquent\SpatialTrait; protected $spatialFields = ['point']; // TODO: only required when fetching, not saving @@ -571,7 +571,7 @@ public function testmodels() class TestNoSpatialModel extends Model { - use \Grimzy\LaravelMysqlSpatial\Eloquent\SpatialTrait; + use \Deprecator\LaravelMysqlSpatial\Eloquent\SpatialTrait; } class TestPDO extends PDO diff --git a/tests/Unit/MysqlConnectionTest.php b/tests/Unit/MysqlConnectionTest.php index cae970a2..e37cb66c 100644 --- a/tests/Unit/MysqlConnectionTest.php +++ b/tests/Unit/MysqlConnectionTest.php @@ -1,7 +1,7 @@ assertException( InvalidArgumentException::class, - 'Grimzy\LaravelMysqlSpatial\Types\GeometryCollection must be a collection of Grimzy\LaravelMysqlSpatial\Types\GeometryInterface' + 'Deprecator\LaravelMysqlSpatial\Types\GeometryCollection must be a collection of Deprecator\LaravelMysqlSpatial\Types\GeometryInterface' ); $geometrycollection = new GeometryCollection([ $this->getPoint(), @@ -112,7 +112,7 @@ public function testArrayAccess() // assert invalid $this->assertException( InvalidArgumentException::class, - 'Grimzy\LaravelMysqlSpatial\Types\GeometryCollection must be a collection of Grimzy\LaravelMysqlSpatial\Types\GeometryInterface' + 'Deprecator\LaravelMysqlSpatial\Types\GeometryCollection must be a collection of Deprecator\LaravelMysqlSpatial\Types\GeometryInterface' ); $geometryCollection[] = 1; } @@ -130,7 +130,7 @@ public function testFromJson() public function testInvalidGeoJsonException() { $this->assertException( - \Grimzy\LaravelMysqlSpatial\Exceptions\InvalidGeoJsonException::class, + \Deprecator\LaravelMysqlSpatial\Exceptions\InvalidGeoJsonException::class, sprintf('Expected %s, got %s', GeoJson\Feature\FeatureCollection::class, GeoJson\Geometry\Point::class) ); GeometryCollection::fromJson('{"type":"Point","coordinates":[3.4,1.2]}'); diff --git a/tests/Unit/Types/GeometryTest.php b/tests/Unit/Types/GeometryTest.php index e51022d5..f592af87 100644 --- a/tests/Unit/Types/GeometryTest.php +++ b/tests/Unit/Types/GeometryTest.php @@ -1,14 +1,14 @@ assertException( - \Grimzy\LaravelMysqlSpatial\Exceptions\InvalidGeoJsonException::class, + \Deprecator\LaravelMysqlSpatial\Exceptions\InvalidGeoJsonException::class, sprintf('Expected %s, got %s', \GeoJson\Geometry\LineString::class, GeoJson\Geometry\Point::class) ); LineString::fromJson('{"type":"Point","coordinates":[3.4,1.2]}'); diff --git a/tests/Unit/Types/MultiLineStringTest.php b/tests/Unit/Types/MultiLineStringTest.php index 16477feb..8c946a34 100644 --- a/tests/Unit/Types/MultiLineStringTest.php +++ b/tests/Unit/Types/MultiLineStringTest.php @@ -1,8 +1,8 @@ assertException( - \Grimzy\LaravelMysqlSpatial\Exceptions\InvalidGeoJsonException::class, + \Deprecator\LaravelMysqlSpatial\Exceptions\InvalidGeoJsonException::class, sprintf('Expected %s, got %s', GeoJson\Geometry\MultiLineString::class, GeoJson\Geometry\Point::class) ); MultiLineString::fromJson('{"type":"Point","coordinates":[3.4,1.2]}'); @@ -64,7 +64,7 @@ public function testInvalidArgumentExceptionAtLeastOneEntry() { $this->assertException( InvalidArgumentException::class, - 'Grimzy\LaravelMysqlSpatial\Types\MultiLineString must contain at least 1 entry' + 'Deprecator\LaravelMysqlSpatial\Types\MultiLineString must contain at least 1 entry' ); $multilinestring = new MultiLineString([]); } @@ -73,7 +73,7 @@ public function testInvalidArgumentExceptionNotArrayOfLineString() { $this->assertException( InvalidArgumentException::class, - 'Grimzy\LaravelMysqlSpatial\Types\MultiLineString must be a collection of Grimzy\LaravelMysqlSpatial\Types\LineString' + 'Deprecator\LaravelMysqlSpatial\Types\MultiLineString must be a collection of Deprecator\LaravelMysqlSpatial\Types\LineString' ); $multilinestring = new MultiLineString([ new LineString([new Point(0, 0), new Point(1, 1)]), @@ -109,7 +109,7 @@ public function testArrayAccess() // assert invalid $this->assertException( InvalidArgumentException::class, - 'Grimzy\LaravelMysqlSpatial\Types\MultiLineString must be a collection of Grimzy\LaravelMysqlSpatial\Types\LineString' + 'Deprecator\LaravelMysqlSpatial\Types\MultiLineString must be a collection of Deprecator\LaravelMysqlSpatial\Types\LineString' ); $multilinestring[] = 1; } diff --git a/tests/Unit/Types/MultiPointTest.php b/tests/Unit/Types/MultiPointTest.php index a8a94f41..8277258c 100644 --- a/tests/Unit/Types/MultiPointTest.php +++ b/tests/Unit/Types/MultiPointTest.php @@ -1,7 +1,7 @@ assertException( - \Grimzy\LaravelMysqlSpatial\Exceptions\InvalidGeoJsonException::class, + \Deprecator\LaravelMysqlSpatial\Exceptions\InvalidGeoJsonException::class, sprintf('Expected %s, got %s', GeoJson\Geometry\MultiPoint::class, GeoJson\Geometry\Point::class) ); MultiPoint::fromJson('{"type":"Point","coordinates":[3.4,1.2]}'); @@ -63,7 +63,7 @@ public function testInvalidArgumentExceptionAtLeastOneEntry() { $this->assertException( InvalidArgumentException::class, - 'Grimzy\LaravelMysqlSpatial\Types\MultiPoint must contain at least 1 entry' + 'Deprecator\LaravelMysqlSpatial\Types\MultiPoint must contain at least 1 entry' ); $multipoint = new MultiPoint([]); } @@ -72,7 +72,7 @@ public function testInvalidArgumentExceptionNotArrayOfLineString() { $this->assertException( InvalidArgumentException::class, - 'Grimzy\LaravelMysqlSpatial\Types\MultiPoint must be a collection of Grimzy\LaravelMysqlSpatial\Types\Point' + 'Deprecator\LaravelMysqlSpatial\Types\MultiPoint must be a collection of Deprecator\LaravelMysqlSpatial\Types\Point' ); $multipoint = new MultiPoint([ new Point(0, 0), @@ -98,7 +98,7 @@ public function testArrayAccess() // assert invalid $this->assertException( InvalidArgumentException::class, - 'Grimzy\LaravelMysqlSpatial\Types\MultiPoint must be a collection of Grimzy\LaravelMysqlSpatial\Types\Point' + 'Deprecator\LaravelMysqlSpatial\Types\MultiPoint must be a collection of Deprecator\LaravelMysqlSpatial\Types\Point' ); $multipoint[] = 1; } diff --git a/tests/Unit/Types/MultiPolygonTest.php b/tests/Unit/Types/MultiPolygonTest.php index 3e49d32d..b2a7dbe0 100644 --- a/tests/Unit/Types/MultiPolygonTest.php +++ b/tests/Unit/Types/MultiPolygonTest.php @@ -1,9 +1,9 @@ assertException( - \Grimzy\LaravelMysqlSpatial\Exceptions\InvalidGeoJsonException::class, + \Deprecator\LaravelMysqlSpatial\Exceptions\InvalidGeoJsonException::class, sprintf('Expected %s, got %s', GeoJson\Geometry\MultiPolygon::class, GeoJson\Geometry\Point::class) ); MultiPolygon::fromJson('{"type":"Point","coordinates":[3.4,1.2]}'); @@ -82,7 +82,7 @@ public function testInvalidArgumentExceptionAtLeastOneEntry() { $this->assertException( InvalidArgumentException::class, - 'Grimzy\LaravelMysqlSpatial\Types\MultiPolygon must contain at least 1 entry' + 'Deprecator\LaravelMysqlSpatial\Types\MultiPolygon must contain at least 1 entry' ); $multipolygon = new MultiPolygon([]); } @@ -91,7 +91,7 @@ public function testInvalidArgumentExceptionNotArrayOfPolygon() { $this->assertException( InvalidArgumentException::class, - 'Grimzy\LaravelMysqlSpatial\Types\MultiPolygon must be a collection of Grimzy\LaravelMysqlSpatial\Types\Polygon' + 'Deprecator\LaravelMysqlSpatial\Types\MultiPolygon must be a collection of Deprecator\LaravelMysqlSpatial\Types\Polygon' ); $multipolygon = new MultiPolygon([ $this->getPolygon1(), @@ -118,7 +118,7 @@ public function testArrayAccess() // assert invalid $this->assertException( InvalidArgumentException::class, - 'Grimzy\LaravelMysqlSpatial\Types\MultiPolygon must be a collection of Grimzy\LaravelMysqlSpatial\Types\Polygon' + 'Deprecator\LaravelMysqlSpatial\Types\MultiPolygon must be a collection of Deprecator\LaravelMysqlSpatial\Types\Polygon' ); $multipolygon[] = 1; } diff --git a/tests/Unit/Types/PointTest.php b/tests/Unit/Types/PointTest.php index 518a8a56..91c0d043 100644 --- a/tests/Unit/Types/PointTest.php +++ b/tests/Unit/Types/PointTest.php @@ -1,6 +1,6 @@ assertException( - \Grimzy\LaravelMysqlSpatial\Exceptions\InvalidGeoJsonException::class, + \Deprecator\LaravelMysqlSpatial\Exceptions\InvalidGeoJsonException::class, 'Expected GeoJson\Geometry\Point, got GeoJson\Geometry\LineString' ); Point::fromJson('{"type": "LineString","coordinates":[[1,1],[2,2]]}'); diff --git a/tests/Unit/Types/PolygonTest.php b/tests/Unit/Types/PolygonTest.php index aaab437b..eac4f409 100644 --- a/tests/Unit/Types/PolygonTest.php +++ b/tests/Unit/Types/PolygonTest.php @@ -1,8 +1,8 @@ assertException( - \Grimzy\LaravelMysqlSpatial\Exceptions\InvalidGeoJsonException::class, + \Deprecator\LaravelMysqlSpatial\Exceptions\InvalidGeoJsonException::class, 'Expected GeoJson\Geometry\Polygon, got GeoJson\Geometry\Point' ); Polygon::fromJson('{"type":"Point","coordinates":[3.4,1.2]}');