Skip to content

Commit a926e23

Browse files
author
Matan Yadaev
committed
follow AAA test pattern
1 parent bfb9a4f commit a926e23

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

tests/Objects/GeometryTest.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
$point = (new Point(91, 0, 4326));
2222
TestPlace::factory()->create(['point' => $point]);
2323
})->toThrow(QueryException::class);
24-
})->skip(fn () => ! (new AxisOrder)->supported(DB::connection()));
24+
})->skip(fn() => !(new AxisOrder)->supported(DB::connection()));
2525

2626
it('throws exception when generating geometry with invalid latitude - without axis-order', function (): void {
2727
expect(function (): void {
@@ -32,14 +32,14 @@
3232
->withDistanceSphere('point', new Point(1, 1, 4326))
3333
->firstOrFail();
3434
})->toThrow(QueryException::class);
35-
})->skip(fn () => (new AxisOrder)->supported(DB::connection()));
35+
})->skip(fn() => (new AxisOrder)->supported(DB::connection()));
3636

3737
it('throws exception when generating geometry with invalid longitude', function (): void {
3838
expect(function (): void {
3939
$point = (new Point(0, 181, 4326));
4040
TestPlace::factory()->create(['point' => $point]);
4141
})->toThrow(QueryException::class);
42-
})->skip(fn () => ! (new AxisOrder)->supported(DB::connection()));
42+
})->skip(fn() => !(new AxisOrder)->supported(DB::connection()));
4343

4444
it('throws exception when generating geometry with invalid longitude - without axis-order', function (): void {
4545
expect(function (): void {
@@ -50,7 +50,7 @@
5050
->withDistanceSphere('point', new Point(1, 1, 4326))
5151
->firstOrFail();
5252
})->toThrow(QueryException::class);
53-
})->skip(fn () => (new AxisOrder)->supported(DB::connection()));
53+
})->skip(fn() => (new AxisOrder)->supported(DB::connection()));
5454

5555
it('throws exception when generating geometry from other geometry WKT', function (): void {
5656
expect(function (): void {
@@ -83,16 +83,18 @@
8383
it('creates an SQL expression from a geometry', function (): void {
8484
$point = new Point(0, 180, 4326);
8585

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()));
8990

9091
it('creates an SQL expression from a geometry - without axis-order', function (): void {
9192
$point = new Point(0, 180, 4326);
9293

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()));
9698

9799
it('creates a geometry object from a geo json array', function (): void {
98100
$point = new Point(0, 180);

0 commit comments

Comments
 (0)