-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathTestCase.php
54 lines (47 loc) · 1.78 KB
/
TestCase.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
namespace MatanYadaev\EloquentSpatial\Tests;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
use MatanYadaev\EloquentSpatial\EloquentSpatial;
use MatanYadaev\EloquentSpatial\EloquentSpatialServiceProvider;
use MatanYadaev\EloquentSpatial\Objects\GeometryCollection;
use MatanYadaev\EloquentSpatial\Objects\LineString;
use MatanYadaev\EloquentSpatial\Objects\MultiLineString;
use MatanYadaev\EloquentSpatial\Objects\MultiPoint;
use MatanYadaev\EloquentSpatial\Objects\MultiPolygon;
use MatanYadaev\EloquentSpatial\Objects\Point;
use MatanYadaev\EloquentSpatial\Objects\Polygon;
use Orchestra\Testbench\TestCase as Orchestra;
class TestCase extends Orchestra
{
protected function setUp(): void
{
parent::setUp();
$this->resetGeometryClasses();
// @phpstan-ignore-next-line
if (version_compare(Application::VERSION, '11.0.0', '>=')) {
$this->loadMigrationsFrom(__DIR__.'/database/migrations-laravel->=11');
} else {
$this->loadMigrationsFrom(__DIR__.'/database/migrations-laravel-<=10');
}
}
/**
* @return class-string<ServiceProvider>[]
*/
protected function getPackageProviders($app): array
{
return [
EloquentSpatialServiceProvider::class,
];
}
protected function resetGeometryClasses(): void
{
EloquentSpatial::useGeometryCollection(GeometryCollection::class);
EloquentSpatial::useLineString(LineString::class);
EloquentSpatial::useMultiLineString(MultiLineString::class);
EloquentSpatial::useMultiPoint(MultiPoint::class);
EloquentSpatial::useMultiPolygon(MultiPolygon::class);
EloquentSpatial::usePoint(Point::class);
EloquentSpatial::usePolygon(Polygon::class);
}
}