Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel 10.x Compatibility #204

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@
}
],
"require": {
"php": ">=7.3",
"php": "^8.0",
"ext-pdo": "*",
"ext-json": "*",
"illuminate/database": "^8.0",
"illuminate/database": "^10.0",
"geo-io/wkb-parser": "^1.0",
"jmikola/geojson": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "~6.5",
"laravel/laravel": "^8.0",
"doctrine/dbal": "^2.5",
"laravel/browser-kit-testing": "^2.0",
"mockery/mockery": "^1.3"
"phpunit/phpunit": "^10.0",
"laravel/laravel": "^10.0",
"doctrine/dbal": "^3.4",
"laravel/browser-kit-testing": "^7.0",
"mockery/mockery": "^1.5"
},
"autoload": {
"psr-4": {
"Grimzy\\LaravelMysqlSpatial\\": "src/"
}
},
"autoload-dev" : {
"classmap" : [
"autoload-dev": {
"classmap": [
"tests/Unit",
"tests/Integration"
]
Expand Down
3 changes: 2 additions & 1 deletion src/Eloquent/SpatialExpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

class SpatialExpression extends Expression
{
public function getValue()
#[\ReturnTypeWillChange]
public function getValue($grammar)
{
return "ST_GeomFromText(?, ?, 'axis-order=long-lat')";
}
Expand Down
4 changes: 4 additions & 0 deletions src/SpatialServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ public function register()
return new DatabaseManager($app, $app['db.factory']);
});

$this->app->bind('db.schema', function ($app) {
return $app['db']->connection()->getSchemaBuilder();
});

if (class_exists(DoctrineType::class)) {
// Prevent geometry type fields from throwing a 'type not found' error when changing them
$geometries = [
Expand Down
7 changes: 4 additions & 3 deletions tests/Integration/IntegrationBaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function createApplication()
*
* @return void
*/
public function setUp()
public function setUp(): void
{
parent::setUp();

Expand All @@ -59,7 +59,7 @@ public function setUp()
//});
}

public function tearDown()
public function tearDown(): void
{
$this->onMigrations(function ($migrationClass) {
(new $migrationClass())->down();
Expand All @@ -71,7 +71,8 @@ public function tearDown()
// MySQL 8.0.4 fixed bug #26941370 and bug #88031
private function isMySQL8AfterFix()
{
$results = DB::select(DB::raw('select version()'));
$expression = DB::raw('select version()');
$results = DB::select($expression->getValue(DB::connection()->getQueryGrammar()));
$mysql_version = $results[0]->{'version()'};

return version_compare($mysql_version, '8.0.4', '>=');
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/BaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

abstract class BaseTestCase extends TestCase
{
public function tearDown()
public function tearDown(): void
{
Mockery::close();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Eloquent/BuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class BuilderTest extends BaseTestCase
protected $builder;
protected $queryBuilder;

protected function setUp()
protected function setUp(): void
{
$connection = Mockery::mock(MysqlConnection::class)->makePartial();
$grammar = Mockery::mock(MySqlGrammar::class)->makePartial();
Expand Down
6 changes: 4 additions & 2 deletions tests/Unit/Eloquent/SpatialTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ class SpatialTraitTest extends BaseTestCase
*/
protected $queries;

public function setUp()
public function setUp(): void
{
$this->model = new TestModel();
$this->queries = &$this->model->getConnection()->getPdo()->queries;
}

public function tearDown()
public function tearDown(): void
{
$this->model->getConnection()->getPdo()->resetQueries();
}
Expand Down Expand Up @@ -580,6 +580,7 @@ class TestPDO extends PDO

public $counter = 1;

#[\ReturnTypeWillChange]
public function prepare($statement, $driver_options = [])
{
$this->queries[] = $statement;
Expand All @@ -593,6 +594,7 @@ public function prepare($statement, $driver_options = [])
return $stmt;
}

#[\ReturnTypeWillChange]
public function lastInsertId($name = null)
{
return $this->counter++;
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/MysqlConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class MysqlConnectionTest extends TestCase
{
private $mysqlConnection;

protected function setUp()
protected function setUp(): void
{
$mysqlConfig = ['driver' => 'mysql', 'prefix' => 'prefix', 'database' => 'database', 'name' => 'foo'];
$this->mysqlConnection = new MysqlConnection(new PDOStub(), 'database', 'prefix', $mysqlConfig);
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Schema/BlueprintTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class BlueprintTest extends BaseTestCase
*/
protected $blueprint;

public function setUp()
public function setUp(): void
{
parent::setUp();

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Types/LineStringTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class LineStringTest extends BaseTestCase
{
private $points;

protected function setUp()
protected function setUp(): void
{
$this->points = [new Point(0, 0), new Point(1, 1), new Point(2, 2)];
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Types/PolygonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class PolygonTest extends BaseTestCase
{
private $polygon;

protected function setUp()
protected function setUp(): void
{
$collection = new LineString(
[
Expand Down