@@ -6,19 +6,19 @@ if [ -z "$REPORT_PORTAL_API_KEY" ] || [ -z "$REPORT_PORTAL_ENDPOINT" ]; then
66 exit 1
77fi
88
9- # Remove /api/v1 from REPORT_PORTAL_ENDPOINT (reportportal/agent-php-PHPUnit requires only host)
10- export REPORT_PORTAL_HOST=${REPORT_PORTAL_ENDPOINT/ \/ api\/ v1 / }
9+ # Remove /api/v1 or api/v2 from REPORT_PORTAL_ENDPOINT (reportportal/agent-php-PHPUnit requires only host)
10+ export REPORT_PORTAL_HOST=${REPORT_PORTAL_ENDPOINT/ \/ api\/ v[12] / }
1111
1212# Add secrets values in tests/reportportal_phpunit_conf_template.xml
13- # Following environment variables are required :
13+ # Following environment variables are used :
1414# REPORT_PORTAL_API_KEY
1515# REPORT_PORTAL_HOST
1616# PHP_VERSION
17- envsubst < tests/reportportal_phpunit_conf_template.xml > tests/reportportal_phpunit_conf.xml
17+ envsubst < tests/reportportal/ reportportal_phpunit_conf_template.xml > tests/reportportal /reportportal_phpunit_conf.xml
1818
1919# Add conf for ReportPortal extension in phpunit.ci.xml
2020# Inserts content of file tests/reportportal_phpunit_conf.xml before </phpunit> end tag in phpunit.ci.xml
21- sed -i $' /<\/phpunit>/{e cat tests/reportportal_phpunit_conf.xml\n }' phpunit.ci.xml
21+ sed -i $' /<\/phpunit>/{e cat tests/reportportal/ reportportal_phpunit_conf.xml\n }' phpunit.ci.xml
2222
2323# Add ReportPortal extension to composer.json
2424# reportportal/phpunit has no stable version, so we set minimum stability to dev only when running tests
@@ -27,7 +27,7 @@ composer config minimum-stability dev
2727composer require --dev reportportal/phpunit
2828
2929# Patch reportportal/basic to make it compatible with api/v2
30- # Use api/v2 instead of api/v1 (hardcoded in reportportal/basic)
31- sed -i ' s /v1\//v2\//g ' vendor/ reportportal/basic/src/service/ReportPortalHTTPService.php
32- # Add launchUuid to finishItem method in reportportal/basic to make it compatible with api/v2
33- sed -i " /function finishItem/,/}/s/\('status' => \$ status\)/\1,\n'launchUuid' => self:: \$ launchID/ " vendor/reportportal/basic/src/service/ReportPortalHTTPService.php
30+ # Patch content:
31+ # * Replace api /v1 (hardcoded in reportportal/basic) by api/v2
32+ # * Add launchUuid to finishItem method (otherwise all tests will be marked as "interrupted")
33+ patch vendor/reportportal/basic/src/service/ReportPortalHTTPService.php tests/reportportal/ReportPortalHTTPService.php.patch
0 commit comments