diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fe2d47a..864c15f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,6 +59,15 @@ jobs: string=': void' grep -r -l "$string" tests/ | xargs sed -i "s/$string//g" + - name: Set ReportPortal configuration + # ReportPortal agent only works for PHP 7.1, 7.2, 7.3 and 7.4 + if: (github.ref_name == 'main' || github.ref_name == 'develop') && vars.REPORT_PORTAL_ENABLED == 'true' && contains(fromJson('["7.1", "7.2", "7.3", "7.4"]'), matrix.php) + run: ./tests/reportportal/reportportal_conf.sh + env: + REPORT_PORTAL_API_KEY: ${{ secrets.REPORT_PORTAL_API_KEY }} + REPORT_PORTAL_ENDPOINT: ${{ vars.REPORT_PORTAL_ENDPOINT }} + PHP_VERSION: ${{ matrix.php }} + - name: PHPUnit run: | case ${{ matrix.php }} in diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ed0b1a..3938659 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # CHANGELOG +## v2.5.0 - 2025-01-30 + +### Changes + +### 🚀 New Features + +- Deprecation of v2/orders status endpoint (#161) +- Not allow empty string for order confirmed business event construct (#160) +- Add v1/me/business event endpoint (#158) + +#### Contributors + +@Francois-Gomis, @alma-renovate-bot[bot], @webaaz, [alma-renovate-bot[bot]](https://github.com/apps/alma-renovate-bot) and [github-actions[bot]](https://github.com/apps/github-actions) + ## v2.4.0 - 2024-12-09 ### Changes @@ -205,6 +219,7 @@ + ``` * Add fields and docs to the Payment entity * Add a Refund entity and extract refunds data within the Payment entity constructor diff --git a/composer.json b/composer.json index e60af78..172a7fa 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "alma/alma-php-client", "description": "PHP API client for the Alma payments API", - "version": "2.4.0", + "version": "2.5.0", "type": "library", "require": { "php": "^5.6 || ~7.0 || ~7.1 || ~7.2 || ~7.3 || ~7.4 || ~8.0 || ~8.1 || ~8.2 || ~8.3", diff --git a/src/Client.php b/src/Client.php index 10f71ec..938b0c4 100644 --- a/src/Client.php +++ b/src/Client.php @@ -30,7 +30,7 @@ class Client { - const VERSION = '2.4.0'; + const VERSION = '2.5.0'; const LIVE_MODE = 'live'; const TEST_MODE = 'test'; diff --git a/tests/reportportal/ReportPortalHTTPService.php.patch b/tests/reportportal/ReportPortalHTTPService.php.patch new file mode 100644 index 0000000..23bdfdc --- /dev/null +++ b/tests/reportportal/ReportPortalHTTPService.php.patch @@ -0,0 +1,37 @@ +312c312 +< $result = self::$client->post('v1/' . self::$projectName . '/launch', array( +--- +> $result = self::$client->post('v2/' . self::$projectName . '/launch', array( +337c337 +< $result = self::$client->put('v1/' . self::$projectName . '/launch/' . self::$launchID . '/finish', array( +--- +> $result = self::$client->put('v2/' . self::$projectName . '/launch/' . self::$launchID . '/finish', array( +358c358 +< $result = self::$client->put('v1/' . self::$projectName . '/launch/' . self::$launchID . '/stop', array( +--- +> $result = self::$client->put('v2/' . self::$projectName . '/launch/' . self::$launchID . '/stop', array( +383c383 +< $result = self::$client->post('v1/' . self::$projectName . '/item', array( +--- +> $result = self::$client->post('v2/' . self::$projectName . '/item', array( +425c425 +< $result = self::$client->post('v1/' . self::$projectName . '/log', array( +--- +> $result = self::$client->post('v2/' . self::$projectName . '/log', array( +478c478 +< 'v1/' . self::$projectName . '/log', +--- +> 'v2/' . self::$projectName . '/log', +500c500 +< $result = self::$client->put('v1/' . self::$projectName . '/item/' . $itemID, array( +--- +> $result = self::$client->put('v2/' . self::$projectName . '/item/' . $itemID, array( +507c507,508 +< 'status' => $status +--- +> 'status' => $status, +> 'launchUuid' => self::$launchID +544c545 +< $result = self::$client->post('v1/' . self::$projectName . '/item/' . $parentItemID, array( +--- +> $result = self::$client->post('v2/' . self::$projectName . '/item/' . $parentItemID, array( diff --git a/tests/reportportal/reportportal_conf.sh b/tests/reportportal/reportportal_conf.sh new file mode 100755 index 0000000..99d7c33 --- /dev/null +++ b/tests/reportportal/reportportal_conf.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +# exit if REPORT_PORTAL_API_KEY or REPORT_PORTAL_ENDPOINT is not set +if [ -z "$REPORT_PORTAL_API_KEY" ] || [ -z "$REPORT_PORTAL_ENDPOINT" ]; then + echo "Please set REPORT_PORTAL_API_KEY and REPORT_PORTAL_ENDPOINT environment variables" + exit 1 +fi + +# Remove /api/v1 or api/v2 from REPORT_PORTAL_ENDPOINT (reportportal/agent-php-PHPUnit requires only host) +export REPORT_PORTAL_HOST=${REPORT_PORTAL_ENDPOINT/\/api\/v[12]/} + +# Add secrets values in tests/reportportal_phpunit_conf_template.xml +# Following environment variables are used: +# REPORT_PORTAL_API_KEY +# REPORT_PORTAL_HOST +# PHP_VERSION +envsubst < tests/reportportal/reportportal_phpunit_conf_template.xml > tests/reportportal/reportportal_phpunit_conf.xml + +# Add conf for ReportPortal extension in phpunit.ci.xml +# Inserts content of file tests/reportportal_phpunit_conf.xml before end tag in phpunit.ci.xml +sed -i $'/<\/phpunit>/{e cat tests/reportportal/reportportal_phpunit_conf.xml\n}' phpunit.ci.xml + +# Add ReportPortal extension to composer.json +# reportportal/phpunit has no stable version, so we set minimum stability to dev only when running tests +composer config minimum-stability dev +# This is not supported by all versions of PHP, so we need to install it separately +composer require --dev reportportal/phpunit + +# Patch reportportal/basic to make it compatible with api/v2 +# Patch content: +# * Replace api/v1 (hardcoded in reportportal/basic) by api/v2 +# * Add launchUuid to finishItem method (otherwise all tests will be marked as "interrupted") +patch vendor/reportportal/basic/src/service/ReportPortalHTTPService.php tests/reportportal/ReportPortalHTTPService.php.patch diff --git a/tests/reportportal/reportportal_phpunit_conf_template.xml b/tests/reportportal/reportportal_phpunit_conf_template.xml new file mode 100644 index 0000000..2b60049 --- /dev/null +++ b/tests/reportportal/reportportal_phpunit_conf_template.xml @@ -0,0 +1,12 @@ + + + + ${REPORT_PORTAL_API_KEY} + ${REPORT_PORTAL_HOST} + integrations + .000+00:00 + alma-php-client PHPUnit tests + PHP version: ${PHP_VERSION} + + +