Skip to content

Commit

Permalink
- Testing laravel 12 support
Browse files Browse the repository at this point in the history
  • Loading branch information
dash8x committed Mar 2, 2025
1 parent 467e482 commit 1ac6c75
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 22 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,22 @@ jobs:
fail-fast: true
matrix:
os: [ ubuntu-latest ]
php: [ 8.3, 8.2, 8.1 ]
laravel: [ 11.*, 10.* ]
php: [ 8.4, 8.3, 8.2, 8.1 ]
laravel: [ 12.*, 11.*, 10.* ]
stability: [ prefer-lowest, prefer-stable ]
include:
- laravel: 12.*
testbench: 10.*
carbon: ^3.8.4
- laravel: 11.*
testbench: 9.*
carbon: ^2.63
- laravel: 10.*
testbench: 8.*
carbon: ^2.63
exclude:
- laravel: 12.*
php: 8.1
- laravel: 11.*
php: 8.1

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
],
"require": {
"php": "^8.1",
"illuminate/support": "^10.0 || ^11.0",
"illuminate/support": "^10.0 || ^11.0 || ^12.0",
"matanyadaev/laravel-eloquent-spatial": "^4.4"
},
"require-dev": {
"laravel/pint": "^1.14",
"orchestra/testbench": "^7.0 || ^8.0 || ^9.0",
"phpunit/phpunit": "^9.5 || ^10.5"
"orchestra/testbench": "^8.0 || ^9.0 || ^10.0",
"phpunit/phpunit": "^10.5 || ^11.5.3"
},
"autoload": {
"psr-4": {
Expand Down
15 changes: 8 additions & 7 deletions tests/Feature/HasSpatialMySqlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Javaabu\Geospatial\Tests\TestCase;
use Javaabu\Geospatial\Tests\TestSupport\Models\City;
use MatanYadaev\EloquentSpatial\Enums\Srid;
use PHPUnit\Framework\Attributes\Test;

class HasSpatialMySqlTest extends TestCase
{
Expand All @@ -24,7 +25,7 @@ public function setUp(): void
parent::setUp();
}

/** @test */
#[Test]
public function it_can_search_within_a_polygon_for_mysql(): void
{
$city = new City();
Expand All @@ -40,7 +41,7 @@ public function it_can_search_within_a_polygon_for_mysql(): void
$this->assertNull(City::withinBounds($in_uligan)->first());
}

/** @test */
#[Test]
public function it_can_set_polygon_for_mysql(): void
{
$city = new City();
Expand All @@ -56,7 +57,7 @@ public function it_can_set_polygon_for_mysql(): void
]);
}

/** @test */
#[Test]
public function it_can_get_polygon_for_mysql(): void
{
$city = new City();
Expand All @@ -70,7 +71,7 @@ public function it_can_get_polygon_for_mysql(): void
$this->assertEquals($wkt, $city->boundary->toWkt());
}

/** @test */
#[Test]
public function it_can_set_coordinates_for_mysql(): void
{
$city = new City();
Expand All @@ -87,7 +88,7 @@ public function it_can_set_coordinates_for_mysql(): void
]);
}

/** @test */
#[Test]
public function it_can_get_coordinates_for_mysql(): void
{
$city = new City();
Expand All @@ -103,7 +104,7 @@ public function it_can_get_coordinates_for_mysql(): void
$this->assertEquals($latitude, $city->lat);
}

/** @test */
#[Test]
public function it_generates_lat_from_the_default_point_column(): void
{
$city = new City();
Expand All @@ -117,7 +118,7 @@ public function it_generates_lat_from_the_default_point_column(): void
$this->assertEquals($latitude, $city->lat);
}

/** @test */
#[Test]
public function it_generates_lng_from_the_default_point_column(): void
{
$city = new City();
Expand Down
9 changes: 5 additions & 4 deletions tests/Feature/HasSpatialSqliteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Javaabu\Geospatial\Tests\TestCase;
use Javaabu\Geospatial\Tests\TestSupport\Models\City;
use MatanYadaev\EloquentSpatial\Enums\Srid;
use PHPUnit\Framework\Attributes\Test;

class HasSpatialSqliteTest extends TestCase
{
Expand All @@ -24,7 +25,7 @@ public function setUp(): void
parent::setUp();
}

/** @test */
#[Test]
public function it_can_set_polygon_for_sqlite(): void
{
$city = new City();
Expand All @@ -40,7 +41,7 @@ public function it_can_set_polygon_for_sqlite(): void
]);
}

/** @test */
#[Test]
public function it_can_get_polygon_for_sqlite(): void
{
$city = new City();
Expand All @@ -54,7 +55,7 @@ public function it_can_get_polygon_for_sqlite(): void
$this->assertEquals($wkt, $city->boundary->toWkt());
}

/** @test */
#[Test]
public function it_can_set_coordinates_for_sqlite(): void
{
$city = new City();
Expand All @@ -71,7 +72,7 @@ public function it_can_set_coordinates_for_sqlite(): void
]);
}

/** @test */
#[Test]
public function it_can_get_coordinates_for_sqlite(): void
{
$city = new City();
Expand Down
13 changes: 7 additions & 6 deletions tests/Feature/ValidationRulesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
use Javaabu\Geospatial\Tests\TestCase;
use Javaabu\Geospatial\Tests\TestSupport\Models\City;
use MatanYadaev\EloquentSpatial\Enums\Srid;
use PHPUnit\Framework\Attributes\Test;

class ValidationRulesTest extends TestCase
{

/** @test */
#[Test]
public function it_can_validate_wkt_geo_polygon(): void
{
$wkt = 'POLYGON((73.5092 4.1758, 73.5094 4.1758, 73.5094 4.1757, 73.5092 4.1757, 73.5092 4.1758))';
Expand All @@ -22,7 +23,7 @@ public function it_can_validate_wkt_geo_polygon(): void
$this->assertFalse($validator->fails());
}

/** @test */
#[Test]
public function it_can_validate_wkt_geo_polygon_without_polygon_prefix(): void
{
$wkt = '(73.5092 4.1758, 73.5094 4.1758, 73.5094 4.1757, 73.5092 4.1757, 73.5092 4.1758)';
Expand All @@ -31,7 +32,7 @@ public function it_can_validate_wkt_geo_polygon_without_polygon_prefix(): void
$this->assertFalse($validator->fails());
}

/** @test */
#[Test]
public function it_checks_if_start_and_end_values_are_same(): void
{
$wkt = 'POLYGON((73.5092 4.1758, 73.5094 4.1758, 73.5094 4.1757, 73.5092 4.1757, 73.5032 4.1718))';
Expand All @@ -40,7 +41,7 @@ public function it_checks_if_start_and_end_values_are_same(): void
$this->assertTrue($validator->fails());
}

/** @test */
#[Test]
public function it_checks_if_the_polygon_has_more_than_two_points(): void
{
$wkt = 'POLYGON((73.5092 4.1758, 73.5092 4.1758))';
Expand All @@ -49,7 +50,7 @@ public function it_checks_if_the_polygon_has_more_than_two_points(): void
$this->assertTrue($validator->fails());
}

/** @test */
#[Test]
public function it_does_not_accept_invalid_point_values(): void
{
$wkt = 'POLYGON((73.5092 4.1758, 73.5094 a4.1758, 73.5094 4.1757, 73.5092 4.1757, 73.5092 4.1758))';
Expand All @@ -58,7 +59,7 @@ public function it_does_not_accept_invalid_point_values(): void
$this->assertTrue($validator->fails());
}

/** @test */
#[Test]
public function it_does_not_accept_invalid_coordinate_values(): void
{
$wkt = 'POLYGON((73.5092 4.1758, 73.5094 14324.1758, 73.5094 4.1757, 73.5092 4.1757, 73.5092 4.1758))';
Expand Down

0 comments on commit 1ac6c75

Please sign in to comment.