|
21 | 21 | $point = (new Point(91, 0, 4326)); |
22 | 22 | TestPlace::factory()->create(['point' => $point]); |
23 | 23 | })->toThrow(QueryException::class); |
24 | | -})->skip(fn () => ! (new AxisOrder)->supported(DB::connection())); |
| 24 | +})->skip(fn() => !(new AxisOrder)->supported(DB::connection())); |
25 | 25 |
|
26 | 26 | it('throws exception when generating geometry with invalid latitude - without axis-order', function (): void { |
27 | 27 | expect(function (): void { |
|
32 | 32 | ->withDistanceSphere('point', new Point(1, 1, 4326)) |
33 | 33 | ->firstOrFail(); |
34 | 34 | })->toThrow(QueryException::class); |
35 | | -})->skip(fn () => (new AxisOrder)->supported(DB::connection())); |
| 35 | +})->skip(fn() => (new AxisOrder)->supported(DB::connection())); |
36 | 36 |
|
37 | 37 | it('throws exception when generating geometry with invalid longitude', function (): void { |
38 | 38 | expect(function (): void { |
39 | 39 | $point = (new Point(0, 181, 4326)); |
40 | 40 | TestPlace::factory()->create(['point' => $point]); |
41 | 41 | })->toThrow(QueryException::class); |
42 | | -})->skip(fn () => ! (new AxisOrder)->supported(DB::connection())); |
| 42 | +})->skip(fn() => !(new AxisOrder)->supported(DB::connection())); |
43 | 43 |
|
44 | 44 | it('throws exception when generating geometry with invalid longitude - without axis-order', function (): void { |
45 | 45 | expect(function (): void { |
|
50 | 50 | ->withDistanceSphere('point', new Point(1, 1, 4326)) |
51 | 51 | ->firstOrFail(); |
52 | 52 | })->toThrow(QueryException::class); |
53 | | -})->skip(fn () => (new AxisOrder)->supported(DB::connection())); |
| 53 | +})->skip(fn() => (new AxisOrder)->supported(DB::connection())); |
54 | 54 |
|
55 | 55 | it('throws exception when generating geometry from other geometry WKT', function (): void { |
56 | 56 | expect(function (): void { |
|
83 | 83 | it('creates an SQL expression from a geometry', function (): void { |
84 | 84 | $point = new Point(0, 180, 4326); |
85 | 85 |
|
86 | | - expect($point->toSqlExpression(DB::connection())) |
87 | | - ->toEqual("ST_GeomFromText('POINT(180 0)', 4326, 'axis-order=long-lat')"); |
88 | | -})->skip(fn () => ! (new AxisOrder)->supported(DB::connection())); |
| 86 | + $sqlExpression = $point->toSqlExpression(DB::connection()); |
| 87 | + |
| 88 | + expect($sqlExpression)->toEqual("ST_GeomFromText('POINT(180 0)', 4326, 'axis-order=long-lat')"); |
| 89 | +})->skip(fn() => !(new AxisOrder)->supported(DB::connection())); |
89 | 90 |
|
90 | 91 | it('creates an SQL expression from a geometry - without axis-order', function (): void { |
91 | 92 | $point = new Point(0, 180, 4326); |
92 | 93 |
|
93 | | - expect($point->toSqlExpression(DB::connection())) |
94 | | - ->toEqual("ST_GeomFromText('POINT(180 0)', 4326)"); |
95 | | -})->skip(fn () => (new AxisOrder)->supported(DB::connection())); |
| 94 | + $sqlExpression = $point->toSqlExpression(DB::connection()); |
| 95 | + |
| 96 | + expect($sqlExpression)->toEqual("ST_GeomFromText('POINT(180 0)', 4326)"); |
| 97 | +})->skip(fn() => (new AxisOrder)->supported(DB::connection())); |
96 | 98 |
|
97 | 99 | it('creates a geometry object from a geo json array', function (): void { |
98 | 100 | $point = new Point(0, 180); |
|
0 commit comments