diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b850e33..f9e740d 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,61 +1,44 @@ name: Run tests + on: push: branches: - # Only mainline branches, features etc are covered on the pull_request trigger - - '*.x' + # Only mainline branches, features etc are covered on the pull_request trigger + - '*.x' pull_request: jobs: + run-tests: - runs-on: ubuntu-latest name: Run tests + runs-on: ubuntu-latest + strategy: fail-fast: false matrix: - php_version: - - '8.1' - - '8.2' - - '8.3' - dependencies: - - 'default' - include: - - php_version: '8.1' - dependencies: 'lowest' - - php_version: '8.2' - dependencies: 'lowest' - - php_version: '8.3' - dependencies: 'lowest' + php-version: + - '8.1' + - '8.2' + - '8.3' + - '8.4' + dependency-versions: + - 'lowest' + - 'default' + steps: - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php_version }} - tools: composer:v2 - - - name: Checkout - uses: actions/checkout@v2 - - - name: Get Composer Cache Directory - id: composer-cache - run: | - echo "::set-output name=dir::$(composer config cache-files-dir)" - - uses: actions/cache@v2 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer-${{ matrix.dependencies }} - - name: Install composer dependencies - env: - DEPENDENCIES: ${{ matrix.dependencies }} - run: | - if [ $DEPENDENCIES == 'lowest' ] - then - composer update --prefer-lowest --no-interaction --no-progress - else - composer install --no-interaction --no-progress - fi - - name: Run unit tests - run: | - vendor/bin/phpunit \ No newline at end of file + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + tools: composer:v2 + + - name: Checkout + uses: actions/checkout@v4 + + - name: Install composer dependencies + uses: ramsey/composer-install@v3 + with: + dependency-versions: ${{ matrix.dependency-versions }} + + - name: Run PHPUnit + run: vendor/bin/phpunit \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 920f23b..f36a8e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ### Unreleased +### v2.4.0 (2025-05-27) + +* Support PHP 8.4 + ### v2.3.0 (2024-11-28) * Add support for venue search endpoint diff --git a/composer.json b/composer.json index c6c10cc..31b1b07 100644 --- a/composer.json +++ b/composer.json @@ -11,12 +11,13 @@ } ], "require": { - "guzzlehttp/guzzle": "^7.0", - "php": "~8.1.0 || ~8.2.0 || ~8.3.0" + "guzzlehttp/guzzle": "^7.9.2", + "php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0" }, "require-dev": { - "phpunit/phpunit": "^10.5", - "ergebnis/phpunit-slow-test-detector": "^2.15" + "guzzlehttp/promises": ">=2.0.4", + "phpunit/phpunit": "^10.5.45", + "ergebnis/phpunit-slow-test-detector": "^2.19.1" }, "support": { "source": "https://github.com/festivalslab/api-client-php", diff --git a/src/FestivalsApiClient.php b/src/FestivalsApiClient.php index c288620..8bacbdc 100644 --- a/src/FestivalsApiClient.php +++ b/src/FestivalsApiClient.php @@ -15,6 +15,7 @@ use GuzzleHttp\Exception\BadResponseException; use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Psr7\Request; +use GuzzleHttp\Utils; use InvalidArgumentException; use Psr\Http\Message\ResponseInterface; use function http_build_query; @@ -123,7 +124,7 @@ protected function createRequest(string $url): Request protected function decodeJsonResponse(ResponseInterface $response): array { try { - return \GuzzleHttp\json_decode((string) $response->getBody(), TRUE); + return Utils::jsonDecode((string) $response->getBody(), TRUE); } catch (InvalidArgumentException $e) { throw FestivalsApiClientException::invalidJsonResponse($response->getStatusCode(), $e); } @@ -160,7 +161,7 @@ protected function handleApiError(BadResponseException $e): void $url = (string) $e->getRequest()->getUri(); try { - $decoded = \GuzzleHttp\json_decode($e->getResponse()->getBody(), TRUE); + $decoded = Utils::jsonDecode($e->getResponse()->getBody(), TRUE); if (isset($decoded['error'])) { $msg = $decoded['error']; }