|
2 | 2 |
|
3 | 3 | use Illuminate\Foundation\Testing\DatabaseMigrations; |
4 | 4 | use Illuminate\Support\Facades\DB; |
| 5 | +use MatanYadaev\EloquentSpatial\AxisOrder; |
5 | 6 | use MatanYadaev\EloquentSpatial\Objects\LineString; |
6 | 7 | use MatanYadaev\EloquentSpatial\Objects\Point; |
7 | 8 | use MatanYadaev\EloquentSpatial\Objects\Polygon; |
|
29 | 30 | ->firstOrFail(); |
30 | 31 |
|
31 | 32 | expect($testPlaceWithDistance->distance)->toBe(156897.79947260793); |
32 | | -})->skip(fn () => DB::isMaria()); |
| 33 | +})->skip(fn () => ! (new AxisOrder)->supported(DB::connection())); |
33 | 34 |
|
34 | | -it('calculates distance between column and geometry - MariaDB', function (): void { |
| 35 | +it('calculates distance between column and geometry - without axis-order', function (): void { |
35 | 36 | TestPlace::factory()->create(['point' => new Point(0, 0, 4326)]); |
36 | 37 |
|
37 | 38 | /** @var TestPlace $testPlaceWithDistance */ |
|
40 | 41 | ->firstOrFail(); |
41 | 42 |
|
42 | 43 | expect($testPlaceWithDistance->distance)->toBe(1.4142135623730951); |
43 | | -})->skip(fn () => ! DB::isMaria()); |
| 44 | +})->skip(fn () => (new AxisOrder)->supported(DB::connection())); |
44 | 45 |
|
45 | 46 | it('calculates distance with alias', function (): void { |
46 | 47 | TestPlace::factory()->create(['point' => new Point(0, 0, 4326)]); |
|
51 | 52 | ->firstOrFail(); |
52 | 53 |
|
53 | 54 | expect($testPlaceWithDistance->distance_in_meters)->toBe(156897.79947260793); |
54 | | -})->skip(fn () => DB::isMaria()); |
| 55 | +})->skip(fn () => ! (new AxisOrder)->supported(DB::connection())); |
55 | 56 |
|
56 | | -it('calculates distance with alias - MariaDB', function (): void { |
| 57 | +it('calculates distance with alias - without axis-order', function (): void { |
57 | 58 | TestPlace::factory()->create(['point' => new Point(0, 0, 4326)]); |
58 | 59 |
|
59 | 60 | /** @var TestPlace $testPlaceWithDistance */ |
|
62 | 63 | ->firstOrFail(); |
63 | 64 |
|
64 | 65 | expect($testPlaceWithDistance->distance_in_meters)->toBe(1.4142135623730951); |
65 | | -})->skip(fn () => ! DB::isMaria()); |
| 66 | +})->skip(fn () => (new AxisOrder)->supported(DB::connection())); |
66 | 67 |
|
67 | 68 | it('filters by distance', function (): void { |
68 | 69 | $pointWithinDistance = new Point(0, 0, 4326); |
|
77 | 78 |
|
78 | 79 | expect($testPlacesWithinDistance)->toHaveCount(1); |
79 | 80 | expect($testPlacesWithinDistance[0]->point)->toEqual($pointWithinDistance); |
80 | | -})->skip(fn () => DB::isMaria()); |
| 81 | +})->skip(fn () => ! (new AxisOrder)->supported(DB::connection())); |
81 | 82 |
|
82 | | -it('filters by distance - MariaDB', function (): void { |
| 83 | +it('filters by distance - without axis-order', function (): void { |
83 | 84 | $pointWithinDistance = new Point(0, 0, 4326); |
84 | 85 | $pointNotWithinDistance = new Point(50, 50, 4326); |
85 | 86 | TestPlace::factory()->create(['point' => $pointWithinDistance]); |
|
92 | 93 |
|
93 | 94 | expect($testPlacesWithinDistance)->toHaveCount(1); |
94 | 95 | expect($testPlacesWithinDistance[0]->point)->toEqual($pointWithinDistance); |
95 | | -})->skip(fn () => ! DB::isMaria()); |
| 96 | +})->skip(fn () => (new AxisOrder)->supported(DB::connection())); |
96 | 97 |
|
97 | 98 | it('orders by distance ASC', function (): void { |
98 | 99 | $closerTestPlace = TestPlace::factory()->create(['point' => new Point(1, 1, 4326)]); |
|
140 | 141 | ->firstOrFail(); |
141 | 142 |
|
142 | 143 | expect($testPlaceWithDistance->distance)->toBe(157249.59776850493); |
143 | | -})->skip(fn () => DB::isMaria()); |
| 144 | +})->skip(fn () =>! (new AxisOrder)->supported(DB::connection())); |
144 | 145 |
|
145 | | -it('calculates distance sphere column and geometry - MariaDB', function (): void { |
| 146 | +it('calculates distance sphere column and geometry - without axis-order', function (): void { |
146 | 147 | TestPlace::factory()->create(['point' => new Point(0, 0, 4326)]); |
147 | 148 |
|
148 | 149 | /** @var TestPlace $testPlaceWithDistance */ |
|
151 | 152 | ->firstOrFail(); |
152 | 153 |
|
153 | 154 | expect($testPlaceWithDistance->distance)->toBe(157249.0357231545); |
154 | | -})->skip(fn () => ! DB::isMaria()); |
| 155 | +})->skip(fn () => (new AxisOrder)->supported(DB::connection())); |
155 | 156 |
|
156 | 157 | it('calculates distance sphere with alias', function (): void { |
157 | 158 | TestPlace::factory()->create(['point' => new Point(0, 0, 4326)]); |
|
162 | 163 | ->firstOrFail(); |
163 | 164 |
|
164 | 165 | expect($testPlaceWithDistance->distance_in_meters)->toBe(157249.59776850493); |
165 | | -})->skip(fn () => DB::isMaria()); |
| 166 | +})->skip(fn () => ! (new AxisOrder)->supported(DB::connection())); |
166 | 167 |
|
167 | | -it('calculates distance sphere with alias - MariaDB', function (): void { |
| 168 | +it('calculates distance sphere with alias - without axis-order', function (): void { |
168 | 169 | TestPlace::factory()->create(['point' => new Point(0, 0, 4326)]); |
169 | 170 |
|
170 | 171 | /** @var TestPlace $testPlaceWithDistance */ |
|
173 | 174 | ->firstOrFail(); |
174 | 175 |
|
175 | 176 | expect($testPlaceWithDistance->distance_in_meters)->toBe(157249.0357231545); |
176 | | -})->skip(fn () => ! DB::isMaria()); |
| 177 | +})->skip(fn () => (new AxisOrder)->supported(DB::connection())); |
177 | 178 |
|
178 | 179 | it('filters distance sphere', function (): void { |
179 | 180 | $pointWithinDistance = new Point(0, 0, 4326); |
|
0 commit comments