Skip to content

Commit fd263cd

Browse files
committed
refactor(tests): replace @test annotations with #[Test] attributes across the test suite for modern PHPUnit syntax
1 parent 53c0142 commit fd263cd

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

tests/HasSpatialTest.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
namespace TarfinLabs\LaravelSpatial\Tests;
44

5+
use PHPUnit\Framework\Attributes\Test;
56
use TarfinLabs\LaravelSpatial\Tests\TestModels\Address;
67
use TarfinLabs\LaravelSpatial\Types\Point;
78

89
class HasSpatialTest extends TestCase
910
{
10-
/** @test */
11+
#[Test]
1112
public function it_generates_sql_query_for_selectDistanceTo_scope(): void
1213
{
1314
// Arrange
@@ -24,7 +25,7 @@ public function it_generates_sql_query_for_selectDistanceTo_scope(): void
2425
);
2526
}
2627

27-
/** @test */
28+
#[Test]
2829
public function it_generates_sql_query_for_withinDistanceTo_scope(): void
2930
{
3031
// 1. Arrange
@@ -41,7 +42,7 @@ public function it_generates_sql_query_for_withinDistanceTo_scope(): void
4142
);
4243
}
4344

44-
/** @test */
45+
#[Test]
4546
public function it_generates_sql_query_for_orderByDistanceTo_scope(): void
4647
{
4748
// 1. Arrange
@@ -64,7 +65,7 @@ public function it_generates_sql_query_for_orderByDistanceTo_scope(): void
6465
);
6566
}
6667

67-
/** @test */
68+
#[Test]
6869
public function it_generates_sql_query_for_location_casted_attributes(): void
6970
{
7071
// 1. Arrange
@@ -78,7 +79,7 @@ public function it_generates_sql_query_for_location_casted_attributes(): void
7879
);
7980
}
8081

81-
/** @test */
82+
#[Test]
8283
public function it_returns_location_casted_attributes(): void
8384
{
8485
// 1. Arrange

tests/PointTest.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
namespace TarfinLabs\LaravelSpatial\Tests;
66

77
use Illuminate\Support\Facades\Config;
8+
use PHPUnit\Framework\Attributes\Test;
89
use TarfinLabs\LaravelSpatial\Types\Point;
910

1011
class PointTest extends TestCase
1112
{
12-
/** @test */
13+
#[Test]
1314
public function it_sets_lat_lng_and_srid_in_constructor(): void
1415
{
1516
// 1. Arrange
@@ -26,7 +27,7 @@ public function it_sets_lat_lng_and_srid_in_constructor(): void
2627
$this->assertSame(expected: $srid, actual: $point->getSrid());
2728
}
2829

29-
/** @test */
30+
#[Test]
3031
public function it_returns_default_lat_lng_and_srid_if_they_are_not_given_in_the_constructor(): void
3132
{
3233
// 1. Act
@@ -38,7 +39,7 @@ public function it_returns_default_lat_lng_and_srid_if_they_are_not_given_in_the
3839
$this->assertSame(expected: 4326, actual: $point->getSrid());
3940
}
4041

41-
/** @test */
42+
#[Test]
4243
public function it_returns_default_srid_in_config_if_it_is_not_null(): void
4344
{
4445
// 1. Arrange
@@ -53,7 +54,7 @@ public function it_returns_default_srid_in_config_if_it_is_not_null(): void
5354
$this->assertSame(expected: 4326, actual: $point->getSrid());
5455
}
5556

56-
/** @test */
57+
#[Test]
5758
public function it_returns_point_as_wkt(): void
5859
{
5960
// 1. Arrange
@@ -66,7 +67,7 @@ public function it_returns_point_as_wkt(): void
6667
$this->assertSame("POINT({$point->getLng()} {$point->getLat()})", $wkt);
6768
}
6869

69-
/** @test */
70+
#[Test]
7071
public function it_returns_point_as_pair(): void
7172
{
7273
// 1. Arrange
@@ -79,10 +80,7 @@ public function it_returns_point_as_pair(): void
7980
$this->assertSame("{$point->getLng()} {$point->getLat()}", $pair);
8081
}
8182

82-
/**
83-
* @test
84-
* @see
85-
*/
83+
#[Test]
8684
public function it_returns_points_as_geometry(): void
8785
{
8886
// 1. Arrange
@@ -95,7 +93,7 @@ public function it_returns_points_as_geometry(): void
9593
$this->assertSame("ST_GeomFromText('{$point->toWkt()}', {$point->getSrid()}, 'axis-order=long-lat')", $geometry);
9694
}
9795

98-
/** @test */
96+
#[Test]
9997
public function it_returns_points_as_array(): void
10098
{
10199
// 1. Arrange

0 commit comments

Comments
 (0)