Skip to content

Commit

Permalink
Updating to Laravel 10
Browse files Browse the repository at this point in the history
  • Loading branch information
joshbaumann committed Mar 6, 2023
1 parent 697b3aa commit ab8550b
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 18 deletions.
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
"php": "^8.0",
"ext-pdo": "*",
"ext-json": "*",
"illuminate/database": "^9.0",
"illuminate/database": "^10.0",
"geo-io/wkb-parser": "^1.0",
"jmikola/geojson": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5.10",
"laravel/laravel": "^8.0",
"doctrine/dbal": "^3.3",
"laravel/browser-kit-testing": "^6.3",
"mockery/mockery": "^1.4.4"
"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": {
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

0 comments on commit ab8550b

Please sign in to comment.