Skip to content

Commit

Permalink
Drop everything below PHP 8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dktapps committed Feb 28, 2024
1 parent d5cb925 commit f1f92fe
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 54 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
31 changes: 5 additions & 26 deletions tests/phpunit/FacingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

namespace pocketmine\math;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

class FacingTest extends TestCase{
Expand All @@ -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));
}
Expand All @@ -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));
Expand All @@ -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));
}
Expand Down Expand Up @@ -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));
}
Expand Down
32 changes: 6 additions & 26 deletions tests/phpunit/Vector3Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

namespace pocketmine\math;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

class Vector3Test extends TestCase{
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand All @@ -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){
Expand All @@ -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));
}
Expand Down

0 comments on commit f1f92fe

Please sign in to comment.