diff --git a/composer.json b/composer.json index 76b619a..a9cedea 100644 --- a/composer.json +++ b/composer.json @@ -4,14 +4,14 @@ "type": "library", "license": "LGPL-3.0", "require": { - "php": "^8.0", + "php": "^8.1", "php-64bit": "*" }, "require-dev": { "phpstan/phpstan": "~1.10.3", "phpstan/extension-installer": "^1.0", "phpstan/phpstan-strict-rules": "^1.0", - "phpunit/phpunit": "^9.5 || ^10.0 || ^11.0" + "phpunit/phpunit": "^10.0 || ^11.0" }, "autoload": { "psr-4": { diff --git a/tests/phpunit/FacingTest.php b/tests/phpunit/FacingTest.php index 3d4dfee..51e3df0 100644 --- a/tests/phpunit/FacingTest.php +++ b/tests/phpunit/FacingTest.php @@ -21,6 +21,7 @@ namespace pocketmine\math; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class FacingTest extends TestCase{ @@ -34,12 +35,7 @@ public static function axisProvider() : \Generator{ yield [Facing::EAST, Axis::X]; } - /** - * @dataProvider axisProvider - * - * @param int $direction - * @param int $axis - */ + #[DataProvider("axisProvider")] public function testAxis(int $direction, int $axis) : void{ self::assertEquals($axis, Facing::axis($direction)); } @@ -50,12 +46,7 @@ public static function oppositeProvider() : \Generator{ yield [Facing::WEST, Facing::EAST]; } - /** - * @dataProvider oppositeProvider - * - * @param int $dir1 - * @param int $dir2 - */ + #[DataProvider("oppositeProvider")] public function testOpposite(int $dir1, int $dir2) : void{ self::assertEquals($dir2, Facing::opposite($dir1)); self::assertEquals($dir1, Facing::opposite($dir2)); @@ -70,12 +61,7 @@ public static function positiveProvider() : \Generator{ yield [Facing::EAST, true]; } - /** - * @dataProvider positiveProvider - * - * @param int $facing - * @param bool $positive - */ + #[DataProvider("positiveProvider")] public function testIsPositive(int $facing, bool $positive) : void{ self::assertEquals($positive, Facing::isPositive($facing)); } @@ -114,14 +100,7 @@ public static function rotateProvider() : \Generator{ yield [Facing::NORTH, Axis::X, false, Facing::UP]; } - /** - * @dataProvider rotateProvider - * - * @param int $direction - * @param int $axis - * @param bool $clockwise - * @param int $expected - */ + #[DataProvider("rotateProvider")] public function testRotate(int $direction, int $axis, bool $clockwise, int $expected) : void{ self::assertEquals($expected, Facing::rotate($direction, $axis, $clockwise)); } diff --git a/tests/phpunit/Vector3Test.php b/tests/phpunit/Vector3Test.php index 134457e..3928213 100644 --- a/tests/phpunit/Vector3Test.php +++ b/tests/phpunit/Vector3Test.php @@ -21,6 +21,7 @@ namespace pocketmine\math; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class Vector3Test extends TestCase{ @@ -52,14 +53,7 @@ public static function minComponentsProvider() : \Generator{ ]; } - /** - * @dataProvider minComponentsProvider - * - * @param Vector3 $vec1 - * @param Vector3 $vec2 - * @param Vector3 $vec3 - * @param Vector3 $expected - */ + #[DataProvider("minComponentsProvider")] public function testMinComponents(Vector3 $vec1, Vector3 $vec2, Vector3 $vec3, Vector3 $expected) : void{ self::assertEquals(Vector3::minComponents($vec1, $vec2, $vec3), $expected); } @@ -91,14 +85,7 @@ public static function maxComponentsProvider() : \Generator{ ]; } - /** - * @dataProvider maxComponentsProvider - * - * @param Vector3 $vec1 - * @param Vector3 $vec2 - * @param Vector3 $vec3 - * @param Vector3 $expected - */ + #[DataProvider("maxComponentsProvider")] public function testMaxComponents(Vector3 $vec1, Vector3 $vec2, Vector3 $vec3, Vector3 $expected) : void{ self::assertEquals(Vector3::maxComponents($vec1, $vec2, $vec3), $expected); } @@ -115,10 +102,9 @@ public static function sumProvider() : \Generator{ } /** - * @dataProvider sumProvider - * * @param Vector3[] $vectors */ + #[DataProvider("sumProvider")] public function testSum(array $vectors) : void{ $vec = new Vector3(0, 0, 0); foreach($vectors as $vector){ @@ -141,14 +127,8 @@ public static function withComponentsProvider() : \Generator{ yield [new Vector3(0, 0, 0), null, null, null, new Vector3(0, 0, 0)]; } - /** - * @dataProvider withComponentsProvider - * - * @param float|int|null $x - * @param float|int|null $y - * @param float|int|null $z - */ - public function testWithComponents(Vector3 $original, $x, $y, $z, Vector3 $expected) : void{ + #[DataProvider("withComponentsProvider")] + public function testWithComponents(Vector3 $original, float|int|null $x, float|int|null $y, float|int|null $z, Vector3 $expected) : void{ $actual = $original->withComponents($x, $y, $z); self::assertTrue($actual->equals($expected)); }