|
3 | 3 | use Illuminate\Database\QueryException;
|
4 | 4 | use Illuminate\Support\Facades\DB;
|
5 | 5 | use MatanYadaev\EloquentSpatial\AxisOrder;
|
| 6 | +use MatanYadaev\EloquentSpatial\Enums\Srid; |
6 | 7 | use MatanYadaev\EloquentSpatial\Objects\Geometry;
|
7 | 8 | use MatanYadaev\EloquentSpatial\Objects\LineString;
|
8 | 9 | use MatanYadaev\EloquentSpatial\Objects\Point;
|
|
18 | 19 |
|
19 | 20 | it('throws exception when generating geometry with invalid latitude', function (): void {
|
20 | 21 | expect(function (): void {
|
21 |
| - $point = (new Point(91, 0, 4326)); |
| 22 | + $point = (new Point(91, 0, Srid::WGS84->value)); |
22 | 23 | TestPlace::factory()->create(['point' => $point]);
|
23 | 24 | })->toThrow(QueryException::class);
|
24 | 25 | })->skip(fn () => ! (new AxisOrder)->supported(DB::connection()));
|
25 | 26 |
|
26 | 27 | it('throws exception when generating geometry with invalid latitude - without axis-order', function (): void {
|
27 | 28 | expect(function (): void {
|
28 |
| - $point = (new Point(91, 0, 4326)); |
| 29 | + $point = (new Point(91, 0, Srid::WGS84->value)); |
29 | 30 | TestPlace::factory()->create(['point' => $point]);
|
30 | 31 |
|
31 | 32 | TestPlace::query()
|
32 |
| - ->withDistanceSphere('point', new Point(1, 1, 4326)) |
| 33 | + ->withDistanceSphere('point', new Point(1, 1, Srid::WGS84->value)) |
33 | 34 | ->firstOrFail();
|
34 | 35 | })->toThrow(QueryException::class);
|
35 | 36 | })->skip(fn () => (new AxisOrder)->supported(DB::connection()));
|
36 | 37 |
|
37 | 38 | it('throws exception when generating geometry with invalid longitude', function (): void {
|
38 | 39 | expect(function (): void {
|
39 |
| - $point = (new Point(0, 181, 4326)); |
| 40 | + $point = (new Point(0, 181, Srid::WGS84->value)); |
40 | 41 | TestPlace::factory()->create(['point' => $point]);
|
41 | 42 | })->toThrow(QueryException::class);
|
42 | 43 | })->skip(fn () => ! (new AxisOrder)->supported(DB::connection()));
|
43 | 44 |
|
44 | 45 | it('throws exception when generating geometry with invalid longitude - without axis-order', function (): void {
|
45 | 46 | expect(function (): void {
|
46 |
| - $point = (new Point(0, 181, 4326)); |
| 47 | + $point = (new Point(0, 181, Srid::WGS84->value)); |
47 | 48 | TestPlace::factory()->create(['point' => $point]);
|
48 | 49 |
|
49 | 50 | TestPlace::query()
|
50 |
| - ->withDistanceSphere('point', new Point(1, 1, 4326)) |
| 51 | + ->withDistanceSphere('point', new Point(1, 1, Srid::WGS84->value)) |
51 | 52 | ->firstOrFail();
|
52 | 53 | })->toThrow(QueryException::class);
|
53 | 54 | })->skip(fn () => (new AxisOrder)->supported(DB::connection()));
|
|
81 | 82 | });
|
82 | 83 |
|
83 | 84 | it('creates an SQL expression from a geometry', function (): void {
|
84 |
| - $point = new Point(0, 180, 4326); |
| 85 | + $point = new Point(0, 180, Srid::WGS84->value); |
85 | 86 |
|
86 | 87 | $expression = $point->toSqlExpression(DB::connection());
|
87 | 88 |
|
|
91 | 92 | })->skip(fn () => ! (new AxisOrder)->supported(DB::connection()));
|
92 | 93 |
|
93 | 94 | it('creates an SQL expression from a geometry - without axis-order', function (): void {
|
94 |
| - $point = new Point(0, 180, 4326); |
| 95 | + $point = new Point(0, 180, Srid::WGS84->value); |
95 | 96 |
|
96 | 97 | $expression = $point->toSqlExpression(DB::connection());
|
97 | 98 |
|
|
0 commit comments