Skip to content

Commit 8c85652

Browse files
committed
adjusted migrations
1 parent 0553188 commit 8c85652

File tree

5 files changed

+46
-5
lines changed

5 files changed

+46
-5
lines changed

phpstan.neon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ parameters:
88
- src/Factory.php
99
ignoreErrors:
1010
-
11-
message: '#Call to an undefined method Illuminate\\Database\\Schema\\ColumnDefinition\:\:isGeometry\(\)#'
12-
path: tests/database/migrations/*.php
11+
message: '#Call to an undefined method Illuminate\\Database\\Schema\\Blueprint\:\:.+\(\)#'
12+
path: 'tests/database/migrations-laravel-<=10/*.php'
1313
-
1414
message: '#Undefined variable: \$this#'
1515
path: tests/Expectations.php

tests/Pest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

3-
use Illuminate\Foundation\Testing\RefreshDatabase;
3+
use Illuminate\Foundation\Testing\DatabaseTransactions;
44
use MatanYadaev\EloquentSpatial\Tests\TestCase;
55

66
uses(TestCase::class)->in(__DIR__);
77

8-
uses(RefreshDatabase::class)->in(__DIR__);
8+
uses(DatabaseTransactions::class)->in(__DIR__);

tests/TestCase.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,24 @@
22

33
namespace MatanYadaev\EloquentSpatial\Tests;
44

5+
use Illuminate\Foundation\Application;
56
use Illuminate\Support\ServiceProvider;
67
use MatanYadaev\EloquentSpatial\EloquentSpatialServiceProvider;
78
use Orchestra\Testbench\TestCase as Orchestra;
9+
use function Orchestra\Testbench\workbench_path;
10+
811

912
class TestCase extends Orchestra
1013
{
1114
protected function setUp(): void
1215
{
1316
parent::setUp();
1417

15-
$this->loadMigrationsFrom(__DIR__.'/database/migrations');
18+
if (version_compare(Application::VERSION, '11.0.0', '>=') || str_starts_with(Application::VERSION, '11.')) {
19+
$this->loadMigrationsFrom(__DIR__.'/database/migrations-laravel->=11');
20+
} else {
21+
$this->loadMigrationsFrom(__DIR__.'/database/migrations-laravel-<=10');
22+
}
1623
}
1724

1825
/**
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
class CreateTestPlacesTable extends Migration
8+
{
9+
public function up(): void
10+
{
11+
Schema::create('test_places', function (Blueprint $table): void {
12+
$table->id();
13+
$table->timestamps();
14+
$table->string('name');
15+
$table->string('address');
16+
$table->geometry('point', subtype: 'point')->nullable();
17+
$table->geometry('multi_point', subtype: 'multipoint')->nullable();
18+
$table->geometry('line_string', subtype: 'linestring')->nullable();
19+
$table->geometry('multi_line_string', subtype: 'multilinestring')->nullable();
20+
$table->geometry('polygon', subtype: 'polygon')->nullable();
21+
$table->geometry('multi_polygon', subtype: 'multipolygon')->nullable();
22+
$table->geometry('geometry_collection', subtype: 'geometrycollection')->nullable();
23+
$table->geometry('point_with_line_string_cast', subtype: 'point')->nullable();
24+
$table->geography('point_geography', subtype: 'point')->nullable();
25+
$table->decimal('longitude')->nullable();
26+
$table->decimal('latitude')->nullable();
27+
});
28+
}
29+
30+
public function down(): void
31+
{
32+
Schema::dropIfExists('test_places');
33+
}
34+
}

0 commit comments

Comments
 (0)