From 60460692437efe9baaba6768ce84fb10d7e1e0c0 Mon Sep 17 00:00:00 2001 From: Allan Fernandes Date: Wed, 27 May 2026 16:13:54 -0300 Subject: [PATCH] fix(nx): exclude abstract test base classes from phpunit.xml.dist at setup time PHPUnit 12 emits a runner warning for every abstract class whose filename ends in Test.php, causing exit code 2 which Nx treats as failure even when all real tests pass. At setup time, use find to discover all Abstract*Test.php / *AbstractTest.php files in the testsuite directory and inject entries into phpunit.xml.dist for the Magento Integration Tests Real Suite. This mirrors the find-based filter added to the full-suite workflow in #375. The patched phpunit.xml.dist is included in the project cache so all matrix runners pick it up without repeating the work. --- nx-integration-tests-setup/action.yml | 29 +++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/nx-integration-tests-setup/action.yml b/nx-integration-tests-setup/action.yml index 81203ca..5fa5aec 100644 --- a/nx-integration-tests-setup/action.yml +++ b/nx-integration-tests-setup/action.yml @@ -111,6 +111,35 @@ runs: nx print-affected --head=HEAD --base=remotes/origin/${{ inputs.pr_base }} > ${AFFECTED_OUTPUT} echo "Affected Projects: $(jq .projects ${AFFECTED_OUTPUT})" + - name: Exclude abstract test base classes from phpunit.xml.dist + working-directory: ./main + shell: bash + run: | + # PHPUnit 12 emits a runner warning for abstract classes whose filename ends + # in Test.php, producing exit code 2 which Nx treats as failure. + # Mirror the find-based filter from the full-suite workflow (see PR #375). + PHPUNIT_CONFIG=dev/tests/integration/phpunit.xml.dist + TMPFILE=$(mktemp) + + find dev/tests/integration/testsuite -type f \ + \( -name 'Abstract*Test.php' -o -name '*AbstractTest.php' \) \ + -print0 | sort -z | while IFS= read -r -d '' file; do + rel="${file#dev/tests/integration/}" + printf ' %s\n' "${rel}" + done > "${TMPFILE}" + + awk -v excludes="${TMPFILE}" ' + /Magento Integration Tests Real Suite/ { in_suite=1 } + in_suite && /<\/testsuite>/ { + while ((getline line < excludes) > 0) print line + in_suite=0 + } + { print } + ' "${PHPUNIT_CONFIG}" > "${PHPUNIT_CONFIG}.tmp" \ + && mv "${PHPUNIT_CONFIG}.tmp" "${PHPUNIT_CONFIG}" + + rm "${TMPFILE}" + - name: Project Cache uses: actions/cache/save@v3 with: