Skip to content

Commit

Permalink
Update PHPUnit
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromegamez committed Jan 18, 2025
1 parent 563fa07 commit 244eec7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"phpstan/phpstan": "^2.0.4",
"phpstan/phpstan-phpunit": "^2.0.3",
"phpstan/phpstan-strict-rules": "^2.0.1",
"phpunit/phpunit": "^10.4.2"
"phpunit/phpunit": "^11.5.3"
},
"autoload": {
"files": ["src/Geohash.php"]
Expand Down
21 changes: 6 additions & 15 deletions tests/GeohashTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,33 @@

use Beste\Geohash;
use InvalidArgumentException;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

class GeohashTest extends TestCase
{
/**
* @dataProvider provideInvalidEncodeParameters
*/
#[DataProvider('provideInvalidEncodeParameters')]
public function testItRejectsInvalidEncodeParameters(float $lat, float $lon, ?int $precision): void
{
$this->expectException(InvalidArgumentException::class);
Geohash::encode($lat, $lon, $precision);
}

/**
* @dataProvider provideInvalidAdjacentParameters
*/
#[DataProvider('provideInvalidAdjacentParameters')]
public function testItRejectsInvalidAdjacentParameters(string $geohash, string $direction): void
{
$this->expectException(InvalidArgumentException::class);
Geohash::adjacent($geohash, $direction);
}

/**
* @dataProvider provideInvalidGeohashes
*/
#[DataProvider('provideInvalidGeohashes')]
public function testItRejectsInvalidDecodeParameters(string $geohash): void
{
$this->expectException(InvalidArgumentException::class);
Geohash::decode($geohash);
}

/**
* @dataProvider provideEncodeParameters
*/
#[DataProvider('provideEncodeParameters')]
public function testItEncodesAndDecodesValues(float $lat, float $lon, ?int $precision): void
{
$encoded = Geohash::encode($lat, $lon, $precision);
Expand All @@ -50,9 +43,7 @@ public function testItEncodesAndDecodesValues(float $lat, float $lon, ?int $prec
self::assertSame($encoded, $reEncoded);
}

/**
* @dataProvider provideGeohashes
*/
#[DataProvider('provideGeohashes')]
public function testItHasNeighbours(string $geohash): void
{
$neighbours = Geohash::neighbours($geohash);
Expand Down

0 comments on commit 244eec7

Please sign in to comment.