From 4818e1cee875413ee339d7ee58de947a72382adf Mon Sep 17 00:00:00 2001 From: Marco Baumgartl Date: Tue, 24 Sep 2024 13:40:34 +0200 Subject: [PATCH] ci: Remove unsupported PHP versions --- .github/workflows/ci.yml | 2 +- composer.json | 5 ++--- tests/ExceptionTest.php | 6 +++--- tests/ParameterTest.php | 9 ++++----- tests/RequestMethodTest.php | 10 +++------- 5 files changed, 13 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ae1bed5..7bd24c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ jobs: runs-on: 'ubuntu-latest' strategy: matrix: - php-versions: ['7.3', '7.4', '8.0', '8.1', '8.2', '8.3'] + php-versions: ['8.2', '8.3'] phpunit-versions: ['latest'] steps: - name: Checkout diff --git a/composer.json b/composer.json index 153cd45..bc77255 100644 --- a/composer.json +++ b/composer.json @@ -33,13 +33,12 @@ }, "prefer-stable": true, "require": { - "php": "^7.3 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0", - "ext-json": "*", + "php": "~8.2.0 || ~8.3.0", "guzzlehttp/guzzle": "^7.4" }, "require-dev": { "http-interop/http-factory-guzzle": "^1.0", - "phpunit/phpunit": "^9.0 || ^10.5" + "phpunit/phpunit": "^11.3.0" }, "archive": { "exclude": [".github/", "tests/", "phpunit.xml.dist"] diff --git a/tests/ExceptionTest.php b/tests/ExceptionTest.php index eb0c3ec..95d9d3c 100644 --- a/tests/ExceptionTest.php +++ b/tests/ExceptionTest.php @@ -16,17 +16,17 @@ use Flora\Exception\UnauthorizedException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\{Request}; -use PHPUnit\Framework\TestCase; +use PHPUnit; use Psr\Http\Message\ResponseInterface; -class ExceptionTest extends TestCase +class ExceptionTest extends PHPUnit\Framework\TestCase { /** * @param string $exceptionClass * @param string $message * @param ResponseInterface $response - * @dataProvider requestExceptionDataProvider */ + #[PHPUnit\Framework\Attributes\DataProvider('requestExceptionDataProvider')] public function testRequestExceptions(string $exceptionClass, string $message, ResponseInterface $response): void { $this->expectException($exceptionClass); diff --git a/tests/ParameterTest.php b/tests/ParameterTest.php index 5448676..ccdd321 100644 --- a/tests/ParameterTest.php +++ b/tests/ParameterTest.php @@ -4,13 +4,12 @@ use Flora\ApiRequestFactory; use GuzzleHttp\Psr7\Uri; -use PHPUnit\Framework\MockObject\MockObject; -use PHPUnit\Framework\TestCase; +use PHPUnit; use Psr\Http\Message\RequestInterface; use Flora\AuthProviderInterface; use Psr\Http\Message\UriInterface; -class ParameterTest extends TestCase +class ParameterTest extends PHPUnit\Framework\TestCase { /** @var UriInterface */ private $uri; @@ -22,11 +21,11 @@ public function setUp(): void } /** - * @dataProvider parameters * @param string $name Parameter name * @param string|int $value Parameter value * @param string $encoded URL-encoded parameter value */ + #[PHPUnit\Framework\Attributes\DataProvider('parameters')] public function testRequestParameter($name, $value, $encoded): void { $request = (new ApiRequestFactory($this->uri))->create(['resource' => 'user', $name => $value]); @@ -107,7 +106,7 @@ public function testParameterOrder(): void public function testAuthorizeParameter(): void { - /** @var MockObject|AuthProviderInterface $authProviderMock */ + /** @var PHPUnit\Framework\MockObject\MockObject|AuthProviderInterface $authProviderMock */ $authProviderMock = $this->getMockBuilder(AuthProviderInterface::class) ->disableOriginalConstructor() ->onlyMethods(['auth']) diff --git a/tests/RequestMethodTest.php b/tests/RequestMethodTest.php index 27b4dec..c3b80bd 100644 --- a/tests/RequestMethodTest.php +++ b/tests/RequestMethodTest.php @@ -4,10 +4,10 @@ use Flora\ApiRequestFactory; use GuzzleHttp\Psr7\Uri; -use PHPUnit\Framework\TestCase; +use PHPUnit; use Psr\Http\Message\UriInterface; -class RequestMethodTest extends TestCase +class RequestMethodTest extends PHPUnit\Framework\TestCase { /** @var UriInterface */ private $uri; @@ -18,11 +18,7 @@ public function setUp(): void $this->uri = new Uri('http://api.example.com'); } - /** - * @param array $params - * @param string $message - * @dataProvider defaultHttpMethodDataProvider - */ + #[PHPUnit\Framework\Attributes\DataProvider('defaultHttpMethodDataProvider')] public function testHttpGetMethod(array $params, string $message): void { $request = (new ApiRequestFactory($this->uri))->create($params);