Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 31 additions & 48 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -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
- 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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 3 additions & 2 deletions src/FestivalsApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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'];
}
Expand Down