Skip to content

Commit ab8550b

Browse files
committed
Updating to Laravel 10
1 parent 697b3aa commit ab8550b

11 files changed

+26
-18
lines changed

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@
1818
"php": "^8.0",
1919
"ext-pdo": "*",
2020
"ext-json": "*",
21-
"illuminate/database": "^9.0",
21+
"illuminate/database": "^10.0",
2222
"geo-io/wkb-parser": "^1.0",
2323
"jmikola/geojson": "^1.0"
2424
},
2525
"require-dev": {
26-
"phpunit/phpunit": "^9.5.10",
27-
"laravel/laravel": "^8.0",
28-
"doctrine/dbal": "^3.3",
29-
"laravel/browser-kit-testing": "^6.3",
30-
"mockery/mockery": "^1.4.4"
26+
"phpunit/phpunit": "^10.0",
27+
"laravel/laravel": "^10.0",
28+
"doctrine/dbal": "^3.4",
29+
"laravel/browser-kit-testing": "^7.0",
30+
"mockery/mockery": "^1.5"
3131
},
3232
"autoload": {
3333
"psr-4": {

src/Eloquent/SpatialExpression.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
class SpatialExpression extends Expression
88
{
9-
public function getValue()
9+
#[\ReturnTypeWillChange]
10+
public function getValue($grammar)
1011
{
1112
return "ST_GeomFromText(?, ?, 'axis-order=long-lat')";
1213
}

src/SpatialServiceProvider.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ public function register()
4141
return new DatabaseManager($app, $app['db.factory']);
4242
});
4343

44+
$this->app->bind('db.schema', function ($app) {
45+
return $app['db']->connection()->getSchemaBuilder();
46+
});
47+
4448
if (class_exists(DoctrineType::class)) {
4549
// Prevent geometry type fields from throwing a 'type not found' error when changing them
4650
$geometries = [

tests/Integration/IntegrationBaseTestCase.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function createApplication()
4444
*
4545
* @return void
4646
*/
47-
public function setUp()
47+
public function setUp(): void
4848
{
4949
parent::setUp();
5050

@@ -59,7 +59,7 @@ public function setUp()
5959
//});
6060
}
6161

62-
public function tearDown()
62+
public function tearDown(): void
6363
{
6464
$this->onMigrations(function ($migrationClass) {
6565
(new $migrationClass())->down();
@@ -71,7 +71,8 @@ public function tearDown()
7171
// MySQL 8.0.4 fixed bug #26941370 and bug #88031
7272
private function isMySQL8AfterFix()
7373
{
74-
$results = DB::select(DB::raw('select version()'));
74+
$expression = DB::raw('select version()');
75+
$results = DB::select($expression->getValue(DB::connection()->getQueryGrammar()));
7576
$mysql_version = $results[0]->{'version()'};
7677

7778
return version_compare($mysql_version, '8.0.4', '>=');

tests/Unit/BaseTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
abstract class BaseTestCase extends TestCase
66
{
7-
public function tearDown()
7+
public function tearDown(): void
88
{
99
Mockery::close();
1010
}

tests/Unit/Eloquent/BuilderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class BuilderTest extends BaseTestCase
2020
protected $builder;
2121
protected $queryBuilder;
2222

23-
protected function setUp()
23+
protected function setUp(): void
2424
{
2525
$connection = Mockery::mock(MysqlConnection::class)->makePartial();
2626
$grammar = Mockery::mock(MySqlGrammar::class)->makePartial();

tests/Unit/Eloquent/SpatialTraitTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ class SpatialTraitTest extends BaseTestCase
2121
*/
2222
protected $queries;
2323

24-
public function setUp()
24+
public function setUp(): void
2525
{
2626
$this->model = new TestModel();
2727
$this->queries = &$this->model->getConnection()->getPdo()->queries;
2828
}
2929

30-
public function tearDown()
30+
public function tearDown(): void
3131
{
3232
$this->model->getConnection()->getPdo()->resetQueries();
3333
}
@@ -580,6 +580,7 @@ class TestPDO extends PDO
580580

581581
public $counter = 1;
582582

583+
#[\ReturnTypeWillChange]
583584
public function prepare($statement, $driver_options = [])
584585
{
585586
$this->queries[] = $statement;
@@ -593,6 +594,7 @@ public function prepare($statement, $driver_options = [])
593594
return $stmt;
594595
}
595596

597+
#[\ReturnTypeWillChange]
596598
public function lastInsertId($name = null)
597599
{
598600
return $this->counter++;

tests/Unit/MysqlConnectionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class MysqlConnectionTest extends TestCase
99
{
1010
private $mysqlConnection;
1111

12-
protected function setUp()
12+
protected function setUp(): void
1313
{
1414
$mysqlConfig = ['driver' => 'mysql', 'prefix' => 'prefix', 'database' => 'database', 'name' => 'foo'];
1515
$this->mysqlConnection = new MysqlConnection(new PDOStub(), 'database', 'prefix', $mysqlConfig);

tests/Unit/Schema/BlueprintTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class BlueprintTest extends BaseTestCase
1414
*/
1515
protected $blueprint;
1616

17-
public function setUp()
17+
public function setUp(): void
1818
{
1919
parent::setUp();
2020

tests/Unit/Types/LineStringTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class LineStringTest extends BaseTestCase
77
{
88
private $points;
99

10-
protected function setUp()
10+
protected function setUp(): void
1111
{
1212
$this->points = [new Point(0, 0), new Point(1, 1), new Point(2, 2)];
1313
}

tests/Unit/Types/PolygonTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class PolygonTest extends BaseTestCase
88
{
99
private $polygon;
1010

11-
protected function setUp()
11+
protected function setUp(): void
1212
{
1313
$collection = new LineString(
1414
[

0 commit comments

Comments
 (0)