Skip to content

Commit 5dc3c1c

Browse files
authored
Add PHP 8.5 support (#499)
- Register PHP 8.5 in Scrutinizer CI - Refactor Dockerfile to support testing across PHP versions - Refactor Makefile to support testing across PHP versions
1 parent 520d534 commit 5dc3c1c

9 files changed

Lines changed: 43 additions & 37 deletions

File tree

.scrutinizer.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,22 @@ build:
3333
- vendor/bin/phpunit
3434

3535
nodes:
36+
php85:
37+
environment:
38+
php: 8.5.0
39+
3640
php84:
3741
environment:
3842
php: 8.4.13
3943

4044
php83:
4145
environment:
42-
php: 8.3.12
46+
php: 8.3.28
4347

4448
php82:
4549
environment:
46-
php: 8.2.24
50+
php: 8.2.29
4751

4852
php81:
4953
environment:
50-
php: 8.1.13
54+
php: 8.1.31

CONTRIBUTING.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,22 @@ You should also remember that the request options object is an object used by us
3838
An example pull request to learn from: https://github.com/amabnl/amadeus-ws-client/pull/74
3939

4040
## Testing your changes
41-
If you have docker installed, simply run `make test`, that will
42-
- build a basic docker image (`make build-docker-image-once`)
43-
- install all dependencies (`make composer-install`)
44-
- and finally run the tests (`make phpunit`)
41+
42+
The project provides a Docker-based test environment to ensure consistency across different PHP versions.
43+
44+
To run the full test suite using the default PHP version (8.5):
45+
46+
```bash
47+
make test
48+
```
49+
50+
To run tests against a specific PHP version (e.g., 8.4):
51+
52+
```bash
53+
php_version=8.4 make test
54+
```
55+
56+
Running `make test` will automatically:
57+
1. Build the Docker image if it doesn't exist (`make build-docker-image-once`).
58+
2. Install dependencies via Composer inside the container (`make composer-install`).
59+
3. Execute the PHPUnit test suite (`make phpunit`).

Dockerfile

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,11 @@
1-
FROM php:8.3-apache
1+
ARG PHP_VERSION=8.5
22

3-
# Requirements
4-
RUN apt-get update \
5-
&& apt-get install -y libxslt1-dev libzip-dev unzip git curl
3+
FROM php:${PHP_VERSION}-cli-alpine
64

7-
# PHP extensions
8-
RUN docker-php-ext-install soap
9-
RUN docker-php-ext-install xsl
5+
RUN apk update && apk add --no-cache \
6+
libxml2-dev \
7+
libxslt-dev
108

11-
# Add the application
12-
ADD . /var/www
13-
WORKDIR /var/www
9+
RUN docker-php-ext-install soap xsl
1410

15-
RUN git config --system --add safe.directory /var/www
16-
17-
# Install composer
18-
RUN curl -sS https://getcomposer.org/installer | php \
19-
&& mv composer.phar /usr/bin/composer
20-
21-
# Install dependencies
22-
RUN composer i
11+
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
image_name = amadeus-ws-client:build
1+
php_version ?= 8.5
2+
image_name = amadeus-ws-client:${php_version}
23

34
SHELL = /bin/sh
45

56
build-docker-image:
6-
docker build -t $(image_name) -f Dockerfile .
7+
docker build -t $(image_name) -f Dockerfile --build-arg PHP_VERSION=$(php_version) .
78

89
build-docker-image-once:
910
make verify-docker-image-exists || make build-docker-image
1011

1112
build-docker-image-no-cache:
12-
docker build --no-cache -t $(image_name) -f Dockerfile .
13+
docker build --no-cache -t $(image_name) -f Dockerfile --build-arg PHP_VERSION=$(php_version) .
1314

1415
verify-docker-image-exists:
1516
docker image inspect $(image_name) >/dev/null 2>&1

src/Amadeus/Client/ResponseHandler/StandardResponseHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,10 @@ protected function makeStatusFromErrorQualifier($qualifier, $defaultStatus = Res
299299
'ZZZ' => Result::STATUS_UNKNOWN
300300
];
301301

302-
if (array_key_exists($qualifier, $statusQualMapping)) {
303-
$status = $statusQualMapping[$qualifier];
304-
} elseif (is_null($qualifier)) {
302+
if (is_null($qualifier)) {
305303
$status = $defaultStatus;
304+
} elseif (array_key_exists($qualifier, $statusQualMapping)) {
305+
$status = $statusQualMapping[$qualifier];
306306
} else {
307307
$status = Result::STATUS_UNKNOWN;
308308
}

src/Amadeus/Client/Session/Handler/Base.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ protected function getWsdlIdFor($messageName)
362362
{
363363
$msgAndVer = $this->getMessagesAndVersions();
364364

365-
if (isset($msgAndVer[$messageName]) && isset($msgAndVer[$messageName]['wsdl'])) {
365+
if (!empty($messageName) && isset($msgAndVer[$messageName]) && isset($msgAndVer[$messageName]['wsdl'])) {
366366
return $msgAndVer[$messageName]['wsdl'];
367367
}
368368

@@ -401,7 +401,6 @@ protected function getSoapClient($msgName)
401401
*/
402402
protected function initSoapClient($wsdlId)
403403
{
404-
// d($wsdlId);
405404
$wsdlPath = WsdlAnalyser::$wsdlIds[$wsdlId];
406405

407406
$client = new Client\SoapClient(

src/Amadeus/Client/SoapClient.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,13 @@ public function __construct($wsdl, $options, ?Log\LoggerInterface $logger = null
6767
* @param string $action The SOAP action.
6868
* @param int $version The SOAP version.
6969
* @param int|null $oneWay
70+
* @param string|null $uriParserClass
7071
* @uses parent::__doRequest
7172
* @return string The XML SOAP response.
7273
* @throws Exception When PHP XSL extension is not enabled or WSDL file isn't readable.
7374
*/
7475
#[\ReturnTypeWillChange]
75-
public function __doRequest($request, $location, $action, $version, $oneWay = null)
76+
public function __doRequest($request, $location, $action, $version, $oneWay = null, $uriParserClass = null)
7677
{
7778
if (!extension_loaded('xsl')) {
7879
throw new Exception('PHP XSL extension is not enabled.');

tests/Amadeus/BaseTestCase.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ class BaseTestCase extends TestCase
4141
protected static function getMethod($helper, $name)
4242
{
4343
$method = new \ReflectionMethod($helper, $name);
44-
$method->setAccessible(true);
4544
return $method;
4645
}
4746

@@ -55,7 +54,6 @@ protected static function getMethod($helper, $name)
5554
protected static function getProperty($helper, $name)
5655
{
5756
$property = new \ReflectionProperty($helper, $name);
58-
$property->setAccessible(true);
5957
return $property;
6058
}
6159

tests/Amadeus/Client/Struct/Pnr/AddMultiElements/TravellerInfoTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ public function testDateOfBirthFormat()
3838
$travellerInfoClass = new \ReflectionClass('\Amadeus\Client\Struct\Pnr\AddMultiElements\TravellerInfo');
3939

4040
$method = $travellerInfoClass->getMethod('formatDateOfBirth');
41-
$method->setAccessible(true);
4241

4342
$travellerInfo = new TravellerInfo();
4443

0 commit comments

Comments
 (0)