diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a2f125df6..4daa66c04 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,6 @@ jobs: - "8.3" - "8.2" - "8.1" - - "8.0" dependencies: - "highest" diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 1f0bfce18..8cffaf99f 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -19,6 +19,7 @@ '@PHP74Migration' => true, '@PHP80Migration:risky' => true, '@PHP80Migration' => true, + '@PHP81Migration' => true, 'concat_space' => ['spacing' => 'one'], 'fopen_flags' => ['b_mode' => true], 'native_function_invocation' => ['include' => ['@all']], diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 2cf17621c..e5c9400d7 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -17,7 +17,7 @@ build: environment: # Languages php: - version: "8.0" + version: "8.1" ini: memory_limit: "-1" diff --git a/CHANGELOG.md b/CHANGELOG.md index 22477e5e3..8e42da1d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Changed - Updates to data for Czechia, Denmark, ETRS89, Portugal and St Helena +- Minimum PHP version increased to 8.1 ## [5.8.0] - 2024-02-03 ### Added diff --git a/composer.json b/composer.json index a7747b745..66bcd45a3 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ ], "license": "(MIT and proprietary)", "require": { - "php": "^8.0", + "php": "^8.1", "ext-zip": "*", "composer-runtime-api": "^2.1", "composer/pcre": "^3.1", @@ -32,7 +32,7 @@ "php-coord/datapack-oceania": "dev-master", "php-coord/datapack-southamerica": "dev-master", "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^9.6||^10.0||^11.0" + "phpunit/phpunit": "^10.5||^11.0" }, "suggest": { "php-coord/datapack-africa": "High-accuracy addon datapack for Africa", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 16f838d5e..7953906eb 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -25,7 +25,7 @@ - + src @@ -34,7 +34,9 @@ src/CoordinateOperation/Params src/Geometry/Extents + + diff --git a/tests/CoordinateOperation/AutoConversionTest.php b/tests/CoordinateOperation/AutoConversionTest.php index 944c9ff4b..5f4db6d64 100644 --- a/tests/CoordinateOperation/AutoConversionTest.php +++ b/tests/CoordinateOperation/AutoConversionTest.php @@ -31,6 +31,8 @@ use PHPCoord\UnitOfMeasure\Angle\Radian; use PHPCoord\UnitOfMeasure\Length\Foot; use PHPCoord\UnitOfMeasure\Length\Metre; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use function array_unique; @@ -565,10 +567,8 @@ public function testRDNAPToITRF2014(): void self::assertEqualsWithDelta(43.0197, $to->getHeight()->asMetres()->getValue(), 0.0001); } - /** - * @group integration - * @dataProvider EPSGConcatenatedOperations - */ + #[DataProvider('EPSGConcatenatedOperations')] + #[Group('integration')] public function testEPSGConcatenatedOperations(string $sourceCrsSrid, string $targetCrsSrid, array $extentCodes, bool $canReverse): void { $extent = BoundingArea::createFromExtentCodes($extentCodes); diff --git a/tests/CoordinateReferenceSystem/CompoundTest.php b/tests/CoordinateReferenceSystem/CompoundTest.php index af0543dc7..b247ac018 100644 --- a/tests/CoordinateReferenceSystem/CompoundTest.php +++ b/tests/CoordinateReferenceSystem/CompoundTest.php @@ -9,6 +9,8 @@ namespace PHPCoord\CoordinateReferenceSystem; use PHPCoord\Exception\UnknownCoordinateReferenceSystemException; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use function count; @@ -37,10 +39,8 @@ public function testCanGetSupportedWithHelp(): void } } - /** - * @group integration - * @dataProvider coordinateReferenceSystems - */ + #[DataProvider('coordinateReferenceSystems')] + #[Group('integration')] public function testCanCreateSupported(string $srid): void { $object = Compound::fromSRID($srid); diff --git a/tests/CoordinateReferenceSystem/GeocentricTest.php b/tests/CoordinateReferenceSystem/GeocentricTest.php index 49b1ff6fd..3c4c8cf5b 100644 --- a/tests/CoordinateReferenceSystem/GeocentricTest.php +++ b/tests/CoordinateReferenceSystem/GeocentricTest.php @@ -9,6 +9,8 @@ namespace PHPCoord\CoordinateReferenceSystem; use PHPCoord\Exception\UnknownCoordinateReferenceSystemException; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use function count; @@ -37,10 +39,8 @@ public function testCanGetSupportedWithHelp(): void } } - /** - * @group integration - * @dataProvider coordinateReferenceSystems - */ + #[DataProvider('coordinateReferenceSystems')] + #[Group('integration')] public function testCanCreateSupported(string $srid): void { $object = Geocentric::fromSRID($srid); diff --git a/tests/CoordinateReferenceSystem/Geographic2DTest.php b/tests/CoordinateReferenceSystem/Geographic2DTest.php index abae89981..b62f1ab33 100644 --- a/tests/CoordinateReferenceSystem/Geographic2DTest.php +++ b/tests/CoordinateReferenceSystem/Geographic2DTest.php @@ -9,6 +9,8 @@ namespace PHPCoord\CoordinateReferenceSystem; use PHPCoord\Exception\UnknownCoordinateReferenceSystemException; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use function count; @@ -37,10 +39,8 @@ public function testCanGetSupportedWithHelp(): void } } - /** - * @group integration - * @dataProvider coordinateReferenceSystems - */ + #[DataProvider('coordinateReferenceSystems')] + #[Group('integration')] public function testCanCreateSupported(string $srid): void { $object = Geographic2D::fromSRID($srid); diff --git a/tests/CoordinateReferenceSystem/Geographic3DTest.php b/tests/CoordinateReferenceSystem/Geographic3DTest.php index 576926e3c..7575c4ee1 100644 --- a/tests/CoordinateReferenceSystem/Geographic3DTest.php +++ b/tests/CoordinateReferenceSystem/Geographic3DTest.php @@ -9,6 +9,8 @@ namespace PHPCoord\CoordinateReferenceSystem; use PHPCoord\Exception\UnknownCoordinateReferenceSystemException; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use function count; @@ -37,10 +39,8 @@ public function testCanGetSupportedWithHelp(): void } } - /** - * @group integration - * @dataProvider coordinateReferenceSystems - */ + #[DataProvider('coordinateReferenceSystems')] + #[Group('integration')] public function testCanCreateSupported(string $srid): void { $object = Geographic3D::fromSRID($srid); diff --git a/tests/CoordinateReferenceSystem/ProjectedTest.php b/tests/CoordinateReferenceSystem/ProjectedTest.php index 48b91b542..a18067ae5 100644 --- a/tests/CoordinateReferenceSystem/ProjectedTest.php +++ b/tests/CoordinateReferenceSystem/ProjectedTest.php @@ -10,6 +10,8 @@ use PHPCoord\CoordinateOperation\CoordinateOperations; use PHPCoord\Exception\UnknownCoordinateReferenceSystemException; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use function count; @@ -38,10 +40,8 @@ public function testCanGetSupportedWithHelp(): void } } - /** - * @group integration - * @dataProvider coordinateReferenceSystems - */ + #[DataProvider('coordinateReferenceSystems')] + #[Group('integration')] public function testCanCreateSupported(string $srid): void { $object = Projected::fromSRID($srid); diff --git a/tests/CoordinateReferenceSystem/VerticalTest.php b/tests/CoordinateReferenceSystem/VerticalTest.php index c622a5df6..b2a407fc9 100644 --- a/tests/CoordinateReferenceSystem/VerticalTest.php +++ b/tests/CoordinateReferenceSystem/VerticalTest.php @@ -9,6 +9,8 @@ namespace PHPCoord\CoordinateReferenceSystem; use PHPCoord\Exception\UnknownCoordinateReferenceSystemException; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use function count; @@ -37,10 +39,8 @@ public function testCanGetSupportedWithHelp(): void } } - /** - * @group integration - * @dataProvider coordinateReferenceSystems - */ + #[DataProvider('coordinateReferenceSystems')] + #[Group('integration')] public function testCanCreateSupported(string $srid): void { $object = Vertical::fromSRID($srid); diff --git a/tests/CoordinateSystem/CartesianTest.php b/tests/CoordinateSystem/CartesianTest.php index 5b49648d8..1c11caae4 100644 --- a/tests/CoordinateSystem/CartesianTest.php +++ b/tests/CoordinateSystem/CartesianTest.php @@ -9,6 +9,8 @@ namespace PHPCoord\CoordinateSystem; use PHPCoord\Exception\UnknownCoordinateSystemException; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use function count; @@ -35,10 +37,8 @@ public function testCanGetSupportedWithHelp(): void } } - /** - * @group integration - * @dataProvider cartesian - */ + #[DataProvider('cartesian')] + #[Group('integration')] public function testCanCreateSupportedCartesian(string $srid): void { $object = Cartesian::fromSRID($srid); diff --git a/tests/CoordinateSystem/EllipsoidalTest.php b/tests/CoordinateSystem/EllipsoidalTest.php index a3a31f1cf..7fe228447 100644 --- a/tests/CoordinateSystem/EllipsoidalTest.php +++ b/tests/CoordinateSystem/EllipsoidalTest.php @@ -9,6 +9,8 @@ namespace PHPCoord\CoordinateSystem; use PHPCoord\Exception\UnknownCoordinateSystemException; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use function count; @@ -35,10 +37,8 @@ public function testCanGetSupportedWithHelp(): void } } - /** - * @group integration - * @dataProvider ellipsoidal - */ + #[DataProvider('ellipsoidal')] + #[Group('integration')] public function testCanCreateSupportedEllipsoidal(string $srid): void { $object = Ellipsoidal::fromSRID($srid); diff --git a/tests/CoordinateSystem/VerticalTest.php b/tests/CoordinateSystem/VerticalTest.php index 25fe57747..61135867a 100644 --- a/tests/CoordinateSystem/VerticalTest.php +++ b/tests/CoordinateSystem/VerticalTest.php @@ -9,6 +9,8 @@ namespace PHPCoord\CoordinateSystem; use PHPCoord\Exception\UnknownCoordinateSystemException; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use function count; @@ -35,10 +37,8 @@ public function testCanGetSupportedWithHelp(): void } } - /** - * @group integration - * @dataProvider vertical - */ + #[DataProvider('vertical')] + #[Group('integration')] public function testCanCreateSupportedVertical(string $srid): void { $object = Vertical::fromSRID($srid); diff --git a/tests/Datum/DatumTest.php b/tests/Datum/DatumTest.php index 32dac22e1..1f6d5eefe 100644 --- a/tests/Datum/DatumTest.php +++ b/tests/Datum/DatumTest.php @@ -10,6 +10,8 @@ use PHPCoord\Exception\UnknownDatumException; use PHPCoord\UnitOfMeasure\Length\Metre; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use function count; @@ -36,10 +38,8 @@ public function testCanGetSupportedWithHelp(): void } } - /** - * @group integration - * @dataProvider datums - */ + #[DataProvider('datums')] + #[Group('integration')] public function testCanCreateSupported(string $srid): void { $object = Datum::fromSRID($srid); diff --git a/tests/Datum/EllipsoidTest.php b/tests/Datum/EllipsoidTest.php index 3d1468f0f..b91f3f120 100644 --- a/tests/Datum/EllipsoidTest.php +++ b/tests/Datum/EllipsoidTest.php @@ -9,6 +9,8 @@ namespace PHPCoord\Datum; use PHPCoord\Exception\UnknownEllipsoidException; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use function count; @@ -35,10 +37,8 @@ public function testCanGetSupportedWithHelp(): void } } - /** - * @group integration - * @dataProvider ellipsoids - */ + #[DataProvider('ellipsoids')] + #[Group('integration')] public function testCanCreateSupported(string $srid): void { $object = Ellipsoid::fromSRID($srid); diff --git a/tests/Datum/PrimeMeridianTest.php b/tests/Datum/PrimeMeridianTest.php index f3f15a9b0..d1278703e 100644 --- a/tests/Datum/PrimeMeridianTest.php +++ b/tests/Datum/PrimeMeridianTest.php @@ -10,6 +10,8 @@ use PHPCoord\Exception\UnknownPrimeMeridianException; use PHPCoord\UnitOfMeasure\Angle\Degree; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use function count; @@ -36,10 +38,8 @@ public function testCanGetSupportedWithHelp(): void } } - /** - * @group integration - * @dataProvider primeMeridians - */ + #[DataProvider('primeMeridians')] + #[Group('integration')] public function testCanCreateSupported(string $srid): void { $object = PrimeMeridian::fromSRID($srid); diff --git a/tests/GIGS/GIGSTest.php b/tests/GIGS/GIGSTest.php index 1b7b707d2..ab0925e38 100644 --- a/tests/GIGS/GIGSTest.php +++ b/tests/GIGS/GIGSTest.php @@ -37,6 +37,9 @@ use PHPCoord\UnitOfMeasure\Length\USSurveyFoot; use PHPCoord\UnitOfMeasure\Scale\Scale; use PHPCoord\UnitOfMeasure\UnitOfMeasureFactory; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Depends; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SplFileObject; @@ -57,14 +60,10 @@ use function trim; use function ucwords; -/** - * @group gigs - */ +#[Group('gigs')] class GIGSTest extends TestCase { - /** - * @dataProvider series2200UnitData - */ + #[DataProvider('series2200UnitData')] public function testSeries2200Units(string $epsgCode, string $unitType, string $unitName, string $baseUnitsPerUnit): void { $unit = UnitOfMeasureFactory::makeUnit(1, 'urn:ogc:def:uom:EPSG::' . $epsgCode); @@ -91,9 +90,7 @@ public static function series2200UnitData(): Generator } } - /** - * @dataProvider series2200EllipsoidData - */ + #[DataProvider('series2200EllipsoidData')] public function testSeries2200Ellipsoids(string $epsgCode, string $name, string $semiMajorAxis, string $semiMajorAxisUnitName, string $semiMajorAxisAsMetres, string $inverseFlattening, string $semiMinorAxis): void { $ellipsoid = Ellipsoid::fromSRID('urn:ogc:def:ellipsoid:EPSG::' . $epsgCode); @@ -122,9 +119,7 @@ public static function series2200EllipsoidData(): Generator } } - /** - * @dataProvider series2200PrimeMeridianData - */ + #[DataProvider('series2200PrimeMeridianData')] public function testSeries2200PrimeMeridians(string $epsgCode, string $name, string $longitudeFromGreenwich, string $longitudeFromGreenwichDegrees): void { $meridian = PrimeMeridian::fromSRID('urn:ogc:def:meridian:EPSG::' . $epsgCode); @@ -146,9 +141,7 @@ public static function series2200PrimeMeridianData(): Generator } } - /** - * @dataProvider series2200GeodeticDatumData - */ + #[DataProvider('series2200GeodeticDatumData')] public function testSeries2200GeodeticDatums(string $epsgCode, string $name, string $ellipsoidName, string $primeMeridianName): void { $datum = Datum::fromSRID('urn:ogc:def:datum:EPSG::' . $epsgCode); @@ -166,9 +159,7 @@ public static function series2200GeodeticDatumData(): Generator } } - /** - * @dataProvider series2200GeodeticCRSData - */ + #[DataProvider('series2200GeodeticCRSData')] public function testSeries2200GeodeticCRSs(string $epsgCode, string $type, string $name, string $datumCode): void { $crs = CoordinateReferenceSystem::fromSRID('urn:ogc:def:crs:EPSG::' . $epsgCode); @@ -198,9 +189,7 @@ public static function series2200GeodeticCRSData(): Generator } } - /** - * @dataProvider series2200ProjectedCRSData - */ + #[DataProvider('series2200ProjectedCRSData')] public function testSeries2200ProjectedCRSs(string $epsgCode, string $datumCode, string $name): void { $crs = Projected::fromSRID('urn:ogc:def:crs:EPSG::' . $epsgCode); @@ -217,9 +206,7 @@ public static function series2200ProjectedCRSData(): Generator } } - /** - * @dataProvider series2200VerticalDatumData - */ + #[DataProvider('series2200VerticalDatumData')] public function testSeries2200VerticalDatums(string $epsgCode, string $name): void { $datum = Datum::fromSRID('urn:ogc:def:datum:EPSG::' . $epsgCode); @@ -235,9 +222,7 @@ public static function series2200VerticalDatumData(): Generator } } - /** - * @dataProvider series2200VerticalCRSData - */ + #[DataProvider('series2200VerticalCRSData')] public function testSeries2200VerticalCRSs(string $epsgCode, string $name, string $datumCode): void { $crs = Vertical::fromSRID('urn:ogc:def:crs:EPSG::' . $epsgCode); @@ -254,9 +239,7 @@ public static function series2200VerticalCRSData(): Generator } } - /** - * @dataProvider series2200OperationData - */ + #[DataProvider('series2200OperationData')] public function testSeries2200Operations(string $epsgCode, string $name, string $method): void { $operation = CoordinateOperations::getOperationData('urn:ogc:def:coordinateOperation:EPSG::' . $epsgCode); @@ -287,9 +270,7 @@ public static function series2200OperationData(): Generator } } - /** - * @dataProvider series3200UnitData - */ + #[DataProvider('series3200UnitData')] public function testSeries3200Units(string $gigsCode, string $unitType, string $unitName, string $baseUnitsPerUnit, string $epsgCode): void { if ($unitType === 'Angle') { @@ -408,10 +389,8 @@ public static function series3200UnitData(): Generator } } - /** - * @depends testSeries3200Units - * @dataProvider series3200EllipsoidData - */ + #[Depends('testSeries3200Units')] + #[DataProvider('series3200EllipsoidData')] public function testSeries3200Ellipsoids(string $gigsCode, string $gigsName, string $semiMajorAxis, $unitName, string $inverseFlattening, string $semiMinorAxis): void { if ($semiMinorAxis === '0' && $inverseFlattening === '0') { @@ -439,10 +418,8 @@ public static function series3200EllipsoidData(): Generator } } - /** - * @depends testSeries3200Units - * @dataProvider series3200PrimeMeridianData - */ + #[Depends('testSeries3200Units')] + #[DataProvider('series3200PrimeMeridianData')] public function testSeries3200PrimeMeridians(string $gigsCode, string $gigsName, string $longitudeFromGreenwich, string $unitName): void { if ($unitName !== 'sexagesimal DMS') { @@ -468,11 +445,9 @@ public static function series3200PrimeMeridianData(): Generator } } - /** - * @depends testSeries3200Ellipsoids - * @depends testSeries3200PrimeMeridians - * @dataProvider series3200GeodeticDatumData - */ + #[Depends('testSeries3200Ellipsoids')] + #[Depends('testSeries3200PrimeMeridians')] + #[DataProvider('series3200GeodeticDatumData')] public function testSeries3200GeodeticDatums(string $gigsCode, string $name, string $ellipsoidName, string $primeMeridianName): void { $ellipsoid = array_flip(Ellipsoid::getSupportedSRIDs())[$ellipsoidName]; @@ -491,10 +466,8 @@ public static function series3200GeodeticDatumData(): Generator } } - /** - * @depends testSeries3200GeodeticDatums - * @dataProvider series3200GeodeticCRSData - */ + #[Depends('testSeries3200GeodeticDatums')] + #[DataProvider('series3200GeodeticCRSData')] public function testSeries3200GeodeticCRSs(string $gigsCode, string $name, string $type, string $datumCode, string $epsgCSCode): void { if ($type === 'Geocentric') { @@ -520,9 +493,7 @@ public static function series3200GeodeticCRSData(): Generator } } - /** - * @dataProvider series3200ConversionData - */ + #[DataProvider('series3200ConversionData')] public function testSeries3200Conversions(string $gigsCode, string $name, string $methodName, string $param1Name, string $param1Value, string $param1Unit, string $param2Name, string $param2Value, string $param2Unit, string $param3Name, string $param3Value, string $param3Unit, string $param4Name, string $param4Value, string $param4Unit, string $param5Name, string $param5Value, string $param5Unit, string $param6Name, string $param6Value, string $param6Unit, string $param7Name, string $param7Value, string $param7Unit, string $epsgOperationCode): void { $uoms = [ @@ -617,10 +588,8 @@ public static function series3200ConversionData(): Generator } } - /** - * @depends testSeries3200GeodeticCRSs - * @dataProvider series3200ProjectionData - */ + #[Depends('testSeries3200GeodeticCRSs')] + #[DataProvider('series3200ProjectionData')] public function testSeries3200Projections(string $gigsCode, string $name, string $baseCRSCode, string $baseCRSName, string $derivingConversionCode, string $derivingConversionName, string $csEPSGCode, string $epsgCode): void { $baseCRS = Geographic2D::fromSRID('urn:ogc:def:crs:GIGS::' . $baseCRSCode); @@ -643,9 +612,7 @@ public static function series3200ProjectionData(): Generator } } - /** - * @dataProvider series3200TransformationData - */ + #[DataProvider('series3200TransformationData')] public function testSeries3200Transformations(string $gigsCode, string $name, string $gigsSourceCRS, string $gigsTargetCRS, string $methodName, string $param1Name, string $param1Value, string $param1Unit, string $param2Name, string $param2Value, string $param2Unit, string $param3Name, string $param3Value, string $param3Unit, string $param4Name, string $param4Value, string $param4Unit, string $param5Name, string $param5Value, string $param5Unit, string $param6Name, string $param6Value, string $param6Unit, string $param7Name, string $param7Value, string $param7Unit, string $param8Name, string $param8Value, string $param8Unit, string $param9Name, string $param9Value, string $param9Unit, string $param10Name, string $param10Value, string $param10Unit, string $epsgOperationCode): void { $uoms = [ @@ -759,9 +726,7 @@ public static function series3200TransformationData(): Generator } } - /** - * @dataProvider series3200VerticalDatumData - */ + #[DataProvider('series3200VerticalDatumData')] public function testSeries3200VerticalDatums(string $gigsCode, string $name): void { Datum::registerCustomDatum('urn:ogc:def:datum:GIGS::' . $gigsCode, $name, Datum::DATUM_TYPE_VERTICAL, null, null, null); @@ -778,10 +743,8 @@ public static function series3200VerticalDatumData(): Generator } } - /** - * @depends testSeries3200VerticalDatums - * @dataProvider series3200VerticalCRSData - */ + #[Depends('testSeries3200VerticalDatums')] + #[DataProvider('series3200VerticalCRSData')] public function testSeries3200VerticalCRSs(string $gigsCode, string $name, string $datumCode, string $epsgCSCode): void { Vertical::registerCustomCRS('urn:ogc:def:crs:GIGS::' . $gigsCode, $name, 'urn:ogc:def:cs:EPSG::' . $epsgCSCode, 'urn:ogc:def:datum:GIGS::' . $datumCode, BoundingArea::createWorld()); @@ -799,9 +762,7 @@ public static function series3200VerticalCRSData(): Generator } } - /** - * @dataProvider series3200VerticalTransformationData - */ + #[DataProvider('series3200VerticalTransformationData')] public function testSeries3200VerticalTransformations(string $gigsCode, string $name, string $gigsSourceCRS, string $gigsTargetCRS, string $methodName, string $param1Name, string $param1Value, string $param1Unit, string $param2Name, string $param2Value, string $param2Unit, string $param3Name, string $param3Value, string $param3Unit, string $param4Name, string $param4Value, string $param4Unit, string $param5Name, string $param5Value, string $param5Unit, string $epsgOperationCode): void { if ($epsgOperationCode) { @@ -870,34 +831,32 @@ public static function series3200VerticalTransformationData(): Generator } } - /** - * @depends testSeries2200Operations - * @depends testSeries3200GeodeticCRSs - * @depends testSeries3200Projections - * @depends testSeries3200Conversions - * @depends testSeries3200Transformations - * @dataProvider series5100TransverseMercatorPart1Data - * @dataProvider series5100TransverseMercatorPart2Data - * @dataProvider series5100TransverseMercatorPart3Data - * @dataProvider series5100TransverseMercatorPart4Data - * @dataProvider series5100LCC1Part1Data - * @dataProvider series5100LCC1Part2Data - * @dataProvider series5100LCC2Part1Data - * @dataProvider series5100LCC2Part2Data - * @dataProvider series5100LCC2Part3Data - * @dataProvider series5100OblStereoData - * @dataProvider series5100HOMBPart1Data - * @dataProvider series5100HOMBPart2Data - * @dataProvider series5100HOMAData - * @dataProvider series5100AmericanPolyconicData - * @dataProvider series5100CassiniSoldnerData - * @dataProvider series5100AlbersData - * @dataProvider series5100LAEAData - * @dataProvider series5100MercatorAPart1Data - * @dataProvider series5100MercatorAPart2Data - * @dataProvider series5100MercatorBData - * @dataProvider series5100TransverseMercatorSouthOrientatedData - */ + #[Depends('testSeries2200Operations')] + #[Depends('testSeries3200GeodeticCRSs')] + #[Depends('testSeries3200Projections')] + #[Depends('testSeries3200Conversions')] + #[Depends('testSeries3200Transformations')] + #[DataProvider('series5100TransverseMercatorPart1Data')] + #[DataProvider('series5100TransverseMercatorPart2Data')] + #[DataProvider('series5100TransverseMercatorPart3Data')] + #[DataProvider('series5100TransverseMercatorPart4Data')] + #[DataProvider('series5100LCC1Part1Data')] + #[DataProvider('series5100LCC1Part2Data')] + #[DataProvider('series5100LCC2Part1Data')] + #[DataProvider('series5100LCC2Part2Data')] + #[DataProvider('series5100LCC2Part3Data')] + #[DataProvider('series5100OblStereoData')] + #[DataProvider('series5100HOMBPart1Data')] + #[DataProvider('series5100HOMBPart2Data')] + #[DataProvider('series5100HOMAData')] + #[DataProvider('series5100AmericanPolyconicData')] + #[DataProvider('series5100CassiniSoldnerData')] + #[DataProvider('series5100AlbersData')] + #[DataProvider('series5100LAEAData')] + #[DataProvider('series5100MercatorAPart1Data')] + #[DataProvider('series5100MercatorAPart2Data')] + #[DataProvider('series5100MercatorBData')] + #[DataProvider('series5100TransverseMercatorSouthOrientatedData')] public function testSeries5100Projections(Angle $latitude, Angle $longitude, Length $easting, Length $northing, bool $inReverse, string $geographicCRSSrid, string $projectedCRSSrid, float $cartesianTolerance, float $geographicTolerance, float $roundTripCartesianTolerance, float $roundTripGeographicTolerance, bool $roundTripPoint): void { $geographicCRS = Geographic2D::fromSRID($geographicCRSSrid); @@ -1296,10 +1255,8 @@ public static function series5100TransverseMercatorSouthOrientatedData(): Genera } } - /** - * @depends testSeries3200GeodeticCRSs - * @dataProvider series5200GeogGeocenData - */ + #[Depends('testSeries3200GeodeticCRSs')] + #[DataProvider('series5200GeogGeocenData')] public function testSeries5200GeographicGeocentric(Length $x, Length $y, Length $z, Angle $latitude, Angle $longitude, Length $height, bool $inReverse, string $geocentricCRSSrid, string $geographicCRSSrid, float $cartesianTolerance, float $geographicTolerance, float $roundTripCartesianTolerance, float $roundTripGeographicTolerance, bool $roundTripPoint): void { $geocentricCRS = Geocentric::fromSRID($geocentricCRSSrid); @@ -1362,18 +1319,16 @@ public static function series5200GeogGeocenData(): Generator } } - /** - * @depends testSeries3200GeodeticCRSs - * @depends testSeries3200Transformations - * @dataProvider series5200PosVecPart1Data - * @dataProvider series5200PosVecPart2Data - * @dataProvider series5200CoordFramePart1Data - * @dataProvider series5200CoordFramePart2Data - * @dataProvider series5200MolBadPart1Data - * @dataProvider series5200MolBadPart2Data - * @dataProvider series5200Geog3DGeoCenData - * @dataProvider series5200Geog2DGeoCenData - */ + #[Depends('testSeries3200GeodeticCRSs')] + #[Depends('testSeries3200Transformations')] + #[DataProvider('series5200PosVecPart1Data')] + #[DataProvider('series5200PosVecPart2Data')] + #[DataProvider('series5200CoordFramePart1Data')] + #[DataProvider('series5200CoordFramePart2Data')] + #[DataProvider('series5200MolBadPart1Data')] + #[DataProvider('series5200MolBadPart2Data')] + #[DataProvider('series5200Geog3DGeoCenData')] + #[DataProvider('series5200Geog2DGeoCenData')] public function testSeries5200GeographicTransformations(Angle $latitude1, Angle $longitude1, ?Length $height1, Angle $latitude2, Angle $longitude2, ?Length $height2, bool $inReverse, string $geographicCRSSrid1, string $geographicCRSSrid2, float $cartesianTolerance, float $geographicTolerance, float $roundTripCartesianTolerance, float $roundTripGeographicTolerance, bool $roundTripPoint, string $operation): void { $geographicCRS1 = Geographic::fromSRID($geographicCRSSrid1); @@ -1567,9 +1522,7 @@ public static function series5200Geog2DGeoCenData(): Generator } } - /** - * @dataProvider series7000DeprecationData - */ + #[DataProvider('series7000DeprecationData')] public function testSeries7000Deprecation(string $epsgCode, string $entityType): void { $this->expectException(UnknownSRIDException::class); diff --git a/tests/Geometry/BoundingAreaTest.php b/tests/Geometry/BoundingAreaTest.php index 1b1c73fb6..6bddda408 100644 --- a/tests/Geometry/BoundingAreaTest.php +++ b/tests/Geometry/BoundingAreaTest.php @@ -8,7 +8,6 @@ namespace PHPCoord\Geometry; -use Composer\InstalledVersions; use PHPCoord\CoordinateOperation\GeographicValue; use PHPCoord\Datum\Datum; use PHPCoord\UnitOfMeasure\Angle\Degree; @@ -100,9 +99,7 @@ public function testAreaCrossesPositiveAntimeridian(): void public function testNetherlandsBufferedCorrectly(): void { - if (InstalledVersions::isInstalled(RegionMap::PACKAGES[RegionMap::REGION_EUROPE])) { - $polygon = BoundingArea::createFromExtentCodes(['urn:ogc:def:area:EPSG::1275']); - self::assertTrue($polygon->containsPoint(new GeographicValue(new Degree(50.965613067768), new Degree(5.8249181759236), null, Datum::fromSRID(Datum::EPSG_WORLD_GEODETIC_SYSTEM_1984_ENSEMBLE)))); - } + $polygon = BoundingArea::createFromExtentCodes(['urn:ogc:def:area:EPSG::1275']); + self::assertTrue($polygon->containsPoint(new GeographicValue(new Degree(50.965613067768), new Degree(5.8249181759236), null, Datum::fromSRID(Datum::EPSG_WORLD_GEODETIC_SYSTEM_1984_ENSEMBLE)))); } } diff --git a/tests/Point/CompoundPointTest.php b/tests/Point/CompoundPointTest.php index b0fdd84b8..13cf081bc 100644 --- a/tests/Point/CompoundPointTest.php +++ b/tests/Point/CompoundPointTest.php @@ -39,6 +39,8 @@ use PHPCoord\Geometry\BoundingArea; use PHPCoord\UnitOfMeasure\Angle\Degree; use PHPCoord\UnitOfMeasure\Length\Metre; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use function class_exists; @@ -95,9 +97,7 @@ public function testCompoundWithEpochDateTimeImmutable(): void self::assertEquals('((123, 456), (789))', $object->__toString()); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceCalculation(): void { $from = CompoundPoint::create( @@ -113,9 +113,7 @@ public function testDistanceCalculation(): void self::assertEqualsWithDelta(115423.134596, $from->calculateDistance($to)->getValue(), 0.000001); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceDifferentCRS(): void { $this->expectException(InvalidCoordinateReferenceSystemException::class); @@ -288,10 +286,8 @@ public function testGeographic3DTo2DPlusGravityHeightBYNCanada(): void self::assertEqualsWithDelta(0.000, $to->getHeight()->getValue(), 0.01); } - /** - * @group integration - * @dataProvider supportedOperations - */ + #[DataProvider('supportedOperations')] + #[Group('integration')] public function testOperations(string $sourceCrsSrid, string $targetCrsSrid, string $operationSrid): void { $operation = CoordinateOperations::getOperationData($operationSrid); diff --git a/tests/Point/GeocentricPointTest.php b/tests/Point/GeocentricPointTest.php index 22f4728b6..a02f57543 100644 --- a/tests/Point/GeocentricPointTest.php +++ b/tests/Point/GeocentricPointTest.php @@ -37,6 +37,8 @@ use PHPCoord\UnitOfMeasure\Scale\PartsPerMillion; use PHPCoord\UnitOfMeasure\Scale\Unity; use PHPCoord\UnitOfMeasure\Time\Year; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use function class_exists; @@ -88,9 +90,7 @@ public function testWithFeetAsUnits(): void self::assertEquals(37.4904, $object->getZ()->getValue()); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceCalculation(): void { $from = GeocentricPoint::create(Geocentric::fromSRID(Geocentric::EPSG_WGS_84), new Metre(6121151.5493), new Metre(-1563978.9235), new Metre(-872615.3556)); @@ -98,9 +98,7 @@ public function testDistanceCalculation(): void self::assertEqualsWithDelta(6824225.464, $from->calculateDistance($to)->getValue(), 0.001); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceDifferentCRSsNoAutoconversion(): void { $this->expectException(InvalidArgumentException::class); @@ -344,10 +342,8 @@ public function testTimeDependentPositionVectorTransformationWithEpoch(): void self::assertEqualsWithDelta(-1690895.108, $to->getZ()->getValue(), 0.001); } - /** - * @group integration - * @dataProvider supportedOperations - */ + #[DataProvider('supportedOperations')] + #[Group('integration')] public function testOperations(string $sourceCrsSrid, string $targetCrsSrid, string $operationSrid): void { $operation = CoordinateOperations::getOperationData($operationSrid); diff --git a/tests/Point/GeographicPoint2DTest.php b/tests/Point/GeographicPoint2DTest.php index eabdff1a8..939eb0a65 100644 --- a/tests/Point/GeographicPoint2DTest.php +++ b/tests/Point/GeographicPoint2DTest.php @@ -26,6 +26,8 @@ use PHPCoord\CoordinateReferenceSystem\Geographic3D; use PHPCoord\Geometry\BoundingArea; use PHPCoord\UnitOfMeasure\Length\Metre; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use function class_exists; @@ -35,10 +37,8 @@ class GeographicPoint2DTest extends TestCase { use Geographic2DSRIDData; - /** - * @group integration - * @dataProvider supportedOperations - */ + #[DataProvider('supportedOperations')] + #[Group('integration')] public function testOperations(string $sourceCrsSrid, string $targetCrsSrid, string $operationSrid): void { $operation = CoordinateOperations::getOperationData($operationSrid); diff --git a/tests/Point/GeographicPoint3DTest.php b/tests/Point/GeographicPoint3DTest.php index e0e5d367f..ada7d303a 100644 --- a/tests/Point/GeographicPoint3DTest.php +++ b/tests/Point/GeographicPoint3DTest.php @@ -43,6 +43,8 @@ use PHPCoord\Geometry\BoundingArea; use PHPCoord\UnitOfMeasure\Angle\Degree; use PHPCoord\UnitOfMeasure\Length\Metre; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use function class_exists; @@ -316,10 +318,8 @@ public function testGeographic3DTo2DPlusGravityHeightIreland(): void self::assertEqualsWithDelta(135.8810, $to->getVerticalPoint()->getHeight()->getValue(), 0.001); } - /** - * @group integration - * @dataProvider supportedOperations - */ + #[DataProvider('supportedOperations')] + #[Group('integration')] public function testOperations(string $sourceCrsSrid, string $targetCrsSrid, string $operationSrid): void { $operation = CoordinateOperations::getOperationData($operationSrid); diff --git a/tests/Point/GeographicPointTest.php b/tests/Point/GeographicPointTest.php index a4b69975e..b655a9857 100644 --- a/tests/Point/GeographicPointTest.php +++ b/tests/Point/GeographicPointTest.php @@ -43,6 +43,7 @@ use PHPCoord\UnitOfMeasure\Scale\Coefficient; use PHPCoord\UnitOfMeasure\Scale\PartsPerMillion; use PHPCoord\UnitOfMeasure\Scale\Unity; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use function class_exists; @@ -119,9 +120,7 @@ public function test3DWithoutHeight(): void $object = GeographicPoint::create(Geographic3D::fromSRID(Geographic3D::EPSG_WGS_84), new Degree(0.123), new Degree(0.456), null); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceCalculation(): void { $from = GeographicPoint::create(Geographic2D::fromSRID(Geographic2D::EPSG_WGS_84), new Degree(51.54105), new Degree(-0.12319), null); @@ -129,9 +128,7 @@ public function testDistanceCalculation(): void self::assertEqualsWithDelta(3680.925, $from->calculateDistance($to)->getValue(), 0.001); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceCalculationReversedOrder(): void { $from = GeographicPoint::create(Geographic2D::fromSRID(Geographic2D::EPSG_WGS_84), new Degree(51.507977), new Degree(-0.124588), null); @@ -139,9 +136,7 @@ public function testDistanceCalculationReversedOrder(): void self::assertEqualsWithDelta(3680.925, $from->calculateDistance($to)->getValue(), 0.001); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceCalculationVincentyExample1(): void { $from = GeographicPoint::create(Geographic2D::fromSRID(Geographic2D::EPSG_CH1903), Degree::fromSexagesimalDMSS('554500.00'), new Degree(0), null); @@ -149,9 +144,7 @@ public function testDistanceCalculationVincentyExample1(): void self::assertEqualsWithDelta(14110526.170, $from->calculateDistance($to)->getValue(), 0.001); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceCalculationVincentyExample2(): void { $from = GeographicPoint::create(Geographic2D::fromSRID(Geographic2D::EPSG_ED50), Degree::fromSexagesimalDMSS('371954.95367'), new Degree(0), null); @@ -159,9 +152,7 @@ public function testDistanceCalculationVincentyExample2(): void self::assertEqualsWithDelta(4085966.703, $from->calculateDistance($to)->getValue(), 0.001); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceCalculationVincentyExample3(): void { $from = GeographicPoint::create(Geographic2D::fromSRID(Geographic2D::EPSG_ED50), Degree::fromSexagesimalDMSS('351611.24862'), new Degree(0), null); @@ -169,9 +160,7 @@ public function testDistanceCalculationVincentyExample3(): void self::assertEqualsWithDelta(8084823.839, $from->calculateDistance($to)->getValue(), 0.001); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceCalculationVincentyExample4(): void { $from = GeographicPoint::create(Geographic2D::fromSRID(Geographic2D::EPSG_ED50), Degree::fromSexagesimalDMSS('10000.00'), new Degree(0), null); @@ -179,9 +168,7 @@ public function testDistanceCalculationVincentyExample4(): void self::assertEqualsWithDelta(19960000.000, $from->calculateDistance($to)->getValue(), 0.001); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceCalculationVincentyExample5(): void { $from = GeographicPoint::create(Geographic2D::fromSRID(Geographic2D::EPSG_ED50), Degree::fromSexagesimalDMSS('10000.00'), new Degree(0), null); @@ -189,9 +176,7 @@ public function testDistanceCalculationVincentyExample5(): void self::assertEqualsWithDelta(19780006.558, $from->calculateDistance($to)->getValue(), 0.001); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceCalculationAntipodeWikiExample1(): void { $from = GeographicPoint::create(Geographic2D::fromSRID(Geographic2D::EPSG_WGS_84), new Degree(0), new Degree(0), null); @@ -199,9 +184,7 @@ public function testDistanceCalculationAntipodeWikiExample1(): void self::assertEqualsWithDelta(19936288.579, $from->calculateDistance($to)->getValue(), 0.001); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceCalculationAntipodeWikiExample2(): void { self::markTestSkipped(); // this doesn't work the rest do, think it might be rounding issues @@ -210,9 +193,7 @@ public function testDistanceCalculationAntipodeWikiExample2(): void self::assertEqualsWithDelta(19944127.421, $from->calculateDistance($to)->getValue(), 0.001); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceCalculationAntipodeVincentyExample1(): void { $from = GeographicPoint::create(Geographic2D::fromSRID(Geographic2D::EPSG_ED50), Degree::fromSexagesimalDMSS('414145.88000'), new Degree(0), null); @@ -220,9 +201,7 @@ public function testDistanceCalculationAntipodeVincentyExample1(): void self::assertEqualsWithDelta(20004566.7228, $from->calculateDistance($to)->getValue(), 0.0001); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceCalculationAntipodeVincentyExample2(): void { $from = GeographicPoint::create(Geographic2D::fromSRID(Geographic2D::EPSG_ED50), new Degree(0), new Degree(0), null); @@ -230,9 +209,7 @@ public function testDistanceCalculationAntipodeVincentyExample2(): void self::assertEqualsWithDelta(19996147.4169, $from->calculateDistance($to)->getValue(), 0.0001); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceCalculationAntipodeVincentyExample3(): void { $from = GeographicPoint::create(Geographic2D::fromSRID(Geographic2D::EPSG_ED50), Degree::fromSexagesimalDMSS('300000.00000'), new Degree(0), null); @@ -240,9 +217,7 @@ public function testDistanceCalculationAntipodeVincentyExample3(): void self::assertEqualsWithDelta(19994364.6069, $from->calculateDistance($to)->getValue(), 0.0001); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceCalculationAntipodeVincentyExample4(): void { self::markTestSkipped(); // this doesn't work the rest do, think it might be rounding issues @@ -251,9 +226,7 @@ public function testDistanceCalculationAntipodeVincentyExample4(): void self::assertEqualsWithDelta(20000433.9629, $from->calculateDistance($to)->getValue(), 0.0001); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceCalculationSmallDistance(): void { $from = GeographicPoint::create(Geographic2D::fromSRID(Geographic2D::EPSG_WGS_84), new Degree(45.306833), new Degree(5.887717), null); @@ -261,9 +234,7 @@ public function testDistanceCalculationSmallDistance(): void self::assertEqualsWithDelta(1.255, $from->calculateDistance($to)->getValue(), 0.001); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceCalculationSmallDistance2(): void { $from = GeographicPoint::create(Geographic2D::fromSRID(Geographic2D::EPSG_WGS_84), new Degree(0), new Degree(0), null); @@ -271,9 +242,7 @@ public function testDistanceCalculationSmallDistance2(): void self::assertEqualsWithDelta(11131.949, $from->calculateDistance($to)->getValue(), 0.001); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceCalculationSmallDistance3(): void { $from = GeographicPoint::create(Geographic2D::fromSRID(Geographic2D::EPSG_WGS_84), new Degree(37.774929), new Degree(-122.419416), null); @@ -281,9 +250,7 @@ public function testDistanceCalculationSmallDistance3(): void self::assertEqualsWithDelta(0, $from->calculateDistance($to)->getValue(), 0.001); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceDifferentCRSs(): void { $from = GeographicPoint::create(Geographic2D::fromSRID(Geographic2D::EPSG_OSGB36), new Degree(51.54105), new Degree(-0.12319), null); @@ -296,9 +263,7 @@ public function testDistanceDifferentCRSs(): void } } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceDifferentCRSsNoAutoconversion(): void { $this->expectException(InvalidCoordinateReferenceSystemException::class); diff --git a/tests/Point/ProjectedPointTest.php b/tests/Point/ProjectedPointTest.php index 6a6989312..fa0fc760f 100644 --- a/tests/Point/ProjectedPointTest.php +++ b/tests/Point/ProjectedPointTest.php @@ -32,6 +32,7 @@ use PHPCoord\UnitOfMeasure\Length\USSurveyFoot; use PHPCoord\UnitOfMeasure\Scale\Coefficient; use PHPCoord\UnitOfMeasure\Scale\Unity; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use function class_exists; @@ -77,9 +78,7 @@ public function testWithFeetAsUnitsEastingNorthing(): void self::assertEquals(37.4904, $object->getNorthing()->getValue()); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceCalculationEastingNorthing(): void { $from = ProjectedPoint::createFromEastingNorthing(Projected::fromSRID(Projected::EPSG_WGS_84_WORLD_MERCATOR), new Metre(438700), new Metre(114800)); @@ -87,9 +86,7 @@ public function testDistanceCalculationEastingNorthing(): void self::assertEqualsWithDelta(115423.134596, $from->calculateDistance($to)->getValue(), 0.000001); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceDifferentCRSEastingNorthing(): void { $from = ProjectedPoint::createFromEastingNorthing(Projected::fromSRID(Projected::EPSG_WGS_84_WORLD_MERCATOR), new Metre(438700), new Metre(114800)); @@ -97,9 +94,7 @@ public function testDistanceDifferentCRSEastingNorthing(): void self::assertEqualsWithDelta(114739.81913, $from->calculateDistance($to)->getValue(), 0.000001); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceDifferentCRSNoAutoconversion(): void { $this->expectException(InvalidCoordinateReferenceSystemException::class); @@ -124,9 +119,7 @@ public function testWithFeetAsUnitsWestingNorthing(): void self::assertEquals(37.4904, $object->getNorthing()->getValue()); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceCalculationWestingNorthing(): void { $from = ProjectedPoint::createFromWestingNorthing(Projected::fromSRID(Projected::EPSG_ETRS89_FAROE_LAMBERT), new Metre(438700), new Metre(114800)); @@ -150,9 +143,7 @@ public function testWithFeetAsUnitsWestingSouthing(): void self::assertEquals(37.4904, $object->getSouthing()->getValue()); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceCalculationWestingSouthing(): void { $from = ProjectedPoint::createFromWestingSouthing(Projected::fromSRID(Projected::EPSG_ST_STEPHEN_GRID_FERRO), new Metre(438700), new Metre(114800)); diff --git a/tests/Point/UTMPointTest.php b/tests/Point/UTMPointTest.php index 3e2eebd24..0434003b2 100644 --- a/tests/Point/UTMPointTest.php +++ b/tests/Point/UTMPointTest.php @@ -11,6 +11,7 @@ use DateTime; use PHPCoord\CoordinateReferenceSystem\Geographic2D; use PHPCoord\UnitOfMeasure\Length\Metre; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; class UTMPointTest extends TestCase @@ -33,9 +34,7 @@ public function testAsGeographicPointSouthernHemisphere(): void self::assertEqualsWithDelta(151.211111, $to->getLongitude()->getValue(), 0.00001); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceSameZone(): void { $from = new UTMPoint(Geographic2D::fromSRID(Geographic2D::EPSG_WGS_84), new Metre(630084), new Metre(4833439), 32, UTMPoint::HEMISPHERE_NORTH); @@ -45,9 +44,7 @@ public function testDistanceSameZone(): void self::assertEquals($distance->getValue(), 500); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceSameZoneDifferentCRS(): void { $from = new UTMPoint(Geographic2D::fromSRID(Geographic2D::EPSG_WGS_84), new Metre(630084), new Metre(4833439), 32, UTMPoint::HEMISPHERE_NORTH, new DateTime('1989-01-01')); @@ -57,9 +54,7 @@ public function testDistanceSameZoneDifferentCRS(): void self::assertEqualsWithDelta($distance->getValue(), 500, 0.1); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceDifferentZoneSameCRS(): void { $from = new UTMPoint(Geographic2D::fromSRID(Geographic2D::EPSG_WGS_84), new Metre(630084), new Metre(4833439), 32, UTMPoint::HEMISPHERE_NORTH); diff --git a/tests/Point/VerticalPointTest.php b/tests/Point/VerticalPointTest.php index 74027d13a..de5cbbb71 100644 --- a/tests/Point/VerticalPointTest.php +++ b/tests/Point/VerticalPointTest.php @@ -32,6 +32,8 @@ use PHPCoord\UnitOfMeasure\Angle\Radian; use PHPCoord\UnitOfMeasure\Length\Foot; use PHPCoord\UnitOfMeasure\Length\Metre; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use function class_exists; @@ -74,9 +76,7 @@ public function testVerticalWithFeetAsUnits(): void self::assertEquals(37.4904, $object->getHeight()->getValue()); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceCalculation(): void { $from = VerticalPoint::create(Vertical::fromSRID(Vertical::EPSG_EGM2008_HEIGHT), new Metre(100)); @@ -84,9 +84,7 @@ public function testDistanceCalculation(): void self::assertEqualsWithDelta(20, $from->calculateDistance($to)->getValue(), 0.000001); } - /** - * @group distance - */ + #[Group('distance')] public function testDistanceCalculationDifferentCRS(): void { $this->expectException(InvalidCoordinateReferenceSystemException::class); @@ -191,10 +189,8 @@ public function testVerticalOffsetGTXUSVERTCON(): void self::assertEqualsWithDelta(247.599, $to->getHeight()->getValue(), 0.001); } - /** - * @group integration - * @dataProvider supportedOperations - */ + #[DataProvider('supportedOperations')] + #[Group('integration')] public function testOperations(string $sourceCrsSrid, string $targetCrsSrid, string $operationSrid): void { $sourceCRS = Vertical::fromSRID($sourceCrsSrid); diff --git a/tests/UnitOfMeasure/Angle/AngleTest.php b/tests/UnitOfMeasure/Angle/AngleTest.php index 75ac8a2f7..d7b8a1d47 100644 --- a/tests/UnitOfMeasure/Angle/AngleTest.php +++ b/tests/UnitOfMeasure/Angle/AngleTest.php @@ -9,6 +9,8 @@ namespace PHPCoord\UnitOfMeasure\Angle; use PHPCoord\Exception\UnknownUnitOfMeasureException; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use function count; @@ -36,10 +38,8 @@ public function testCanGetSupportedWithHelp(): void } } - /** - * @group integration - * @dataProvider unitsOfMeasure - */ + #[DataProvider('unitsOfMeasure')] + #[Group('integration')] public function testCanCreateAllUnits(string $srid): void { $dummyValue = 1; diff --git a/tests/UnitOfMeasure/Length/LengthTest.php b/tests/UnitOfMeasure/Length/LengthTest.php index 599a1a789..42249479f 100644 --- a/tests/UnitOfMeasure/Length/LengthTest.php +++ b/tests/UnitOfMeasure/Length/LengthTest.php @@ -9,6 +9,8 @@ namespace PHPCoord\UnitOfMeasure\Length; use PHPCoord\Exception\UnknownUnitOfMeasureException; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use function count; @@ -35,10 +37,8 @@ public function testCanGetSupportedWithHelp(): void } } - /** - * @group integration - * @dataProvider unitsOfMeasure - */ + #[DataProvider('unitsOfMeasure')] + #[Group('integration')] public function testCanCreateAllUnits(string $srid): void { $newUnit = Length::makeUnit(1, $srid); diff --git a/tests/UnitOfMeasure/RateTest.php b/tests/UnitOfMeasure/RateTest.php index 61d012c4d..1c39af2f9 100644 --- a/tests/UnitOfMeasure/RateTest.php +++ b/tests/UnitOfMeasure/RateTest.php @@ -12,6 +12,8 @@ use PHPCoord\UnitOfMeasure\Length\Metre; use PHPCoord\UnitOfMeasure\Time\Time; use PHPCoord\UnitOfMeasure\Time\Year; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use function count; @@ -62,10 +64,8 @@ public function testCanGetSupportedWithHelp(): void } } - /** - * @group integration - * @dataProvider unitsOfMeasure - */ + #[DataProvider('unitsOfMeasure')] + #[Group('integration')] public function testCanCreateAllUnits(string $srid): void { $newUnit = Rate::makeUnit(1, $srid); diff --git a/tests/UnitOfMeasure/Scale/ScaleTest.php b/tests/UnitOfMeasure/Scale/ScaleTest.php index c156fcc43..15558819e 100644 --- a/tests/UnitOfMeasure/Scale/ScaleTest.php +++ b/tests/UnitOfMeasure/Scale/ScaleTest.php @@ -9,6 +9,8 @@ namespace PHPCoord\UnitOfMeasure\Scale; use PHPCoord\Exception\UnknownUnitOfMeasureException; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use function count; @@ -35,10 +37,8 @@ public function testCanGetSupportedWithHelp(): void } } - /** - * @group integration - * @dataProvider unitsOfMeasure - */ + #[DataProvider('unitsOfMeasure')] + #[Group('integration')] public function testCanCreateAllUnits(string $srid): void { $newUnit = Scale::makeUnit(1, $srid); diff --git a/tests/UnitOfMeasure/Time/TimeTest.php b/tests/UnitOfMeasure/Time/TimeTest.php index af682ccb8..b893b54e0 100644 --- a/tests/UnitOfMeasure/Time/TimeTest.php +++ b/tests/UnitOfMeasure/Time/TimeTest.php @@ -9,6 +9,8 @@ namespace PHPCoord\UnitOfMeasure\Time; use PHPCoord\Exception\UnknownUnitOfMeasureException; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use function count; @@ -35,10 +37,8 @@ public function testCanGetSupportedWithHelp(): void } } - /** - * @group integration - * @dataProvider unitsOfMeasure - */ + #[DataProvider('unitsOfMeasure')] + #[Group('integration')] public function testCanCreateAllUnits(string $srid): void { $newUnit = Time::makeUnit(1, $srid); diff --git a/tests/UnitOfMeasure/UnitOfMeasureFactoryTest.php b/tests/UnitOfMeasure/UnitOfMeasureFactoryTest.php index 255d2c1b8..e209dde27 100644 --- a/tests/UnitOfMeasure/UnitOfMeasureFactoryTest.php +++ b/tests/UnitOfMeasure/UnitOfMeasureFactoryTest.php @@ -10,6 +10,8 @@ use PHPCoord\Exception\UnknownUnitOfMeasureException; use PHPCoord\UnitOfMeasure\Angle\Angle; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use function count; @@ -27,10 +29,8 @@ public function testCanGetSupported(): void } } - /** - * @group integration - * @dataProvider unitsOfMeasure - */ + #[DataProvider('unitsOfMeasure')] + #[Group('integration')] public function testCanCreateAllUnits(string $srid): void { $dummyValue = 1;