diff --git a/.gitattributes b/.gitattributes index a69a0df..2248014 100644 --- a/.gitattributes +++ b/.gitattributes @@ -11,6 +11,7 @@ /phpcs.xml.dist export-ignore /phpstan.neon.dist export-ignore /phpunit.xml.dist export-ignore +/phpunitlte9.xml.dist export-ignore /phpunit-bootstrap.php export-ignore /PHPCSDebug/Tests export-ignore /Tests export-ignore diff --git a/.github/workflows/quicktest.yml b/.github/workflows/quicktest.yml index c1e237f..86b84a9 100644 --- a/.github/workflows/quicktest.yml +++ b/.github/workflows/quicktest.yml @@ -96,9 +96,22 @@ jobs: if: ${{ matrix.phpcs_version == 'dev-master' }} run: composer check-complete + - name: Grab PHPUnit version + id: phpunit_version + run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> $GITHUB_OUTPUT + + - name: Determine PHPUnit composer script to use + id: phpunit_script + run: | + if [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) || startsWith( steps.phpunit_version.outputs.VERSION, '11.' ) }}" == "true" ]; then + echo 'SUFFIX=' >> $GITHUB_OUTPUT + else + echo 'SUFFIX=-lte9' >> $GITHUB_OUTPUT + fi + - name: Run the unit tests for the PHPCSDebug sniff - run: composer test-sniff + run: composer test-sniff${{ steps.phpunit_script.outputs.SUFFIX }} - name: Run the unit tests for the DevTools if: ${{ matrix.phpcs_version == 'dev-master' }} - run: composer test-tools + run: composer test-tools${{ steps.phpunit_script.outputs.SUFFIX }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 83994e2..7d63b64 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -150,9 +150,22 @@ jobs: if: matrix.phpcs_version == 'dev-master' run: composer check-complete + - name: Grab PHPUnit version + id: phpunit_version + run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> $GITHUB_OUTPUT + + - name: Determine PHPUnit composer script to use + id: phpunit_script + run: | + if [ "${{ startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) || startsWith( steps.phpunit_version.outputs.VERSION, '11.' ) }}" == "true" ]; then + echo 'SUFFIX=' >> $GITHUB_OUTPUT + else + echo 'SUFFIX=-lte9' >> $GITHUB_OUTPUT + fi + - name: Run the unit tests for the PHPCSDebug sniff - run: composer test-sniff + run: composer test-sniff${{ steps.phpunit_script.outputs.SUFFIX }} - name: Run the unit tests for the DevTools if: ${{ matrix.phpcs_version == 'dev-master' }} - run: composer test-tools + run: composer test-tools${{ steps.phpunit_script.outputs.SUFFIX }} diff --git a/.gitignore b/.gitignore index 1b0eeda..817ab77 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,10 @@ +build/ deploy/ vendor/ composer.lock .phpcs.xml phpcs.xml phpunit.xml +phpunitlte9.xml .phpunit.result.cache phpstan.neon diff --git a/composer.json b/composer.json index eb097c2..a8afd0e 100644 --- a/composer.json +++ b/composer.json @@ -28,12 +28,12 @@ }, "require-dev" : { "roave/security-advisories" : "dev-master", - "phpunit/phpunit" : "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0", + "phpunit/phpunit" : "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.5.32 || ^11.3.3", "php-parallel-lint/php-parallel-lint": "^1.4.0", "php-parallel-lint/php-console-highlighter": "^1.0.0", "phpcsstandards/phpcsdevcs": "^1.1.6", "phpcsstandards/phpcsutils" : "^1.0", - "yoast/phpunit-polyfills": "^1.1" + "yoast/phpunit-polyfills": "^1.1 || ^2.0 || ^3.0" }, "config": { "allow-plugins": { @@ -73,6 +73,15 @@ "test-tools": [ "@php ./vendor/phpunit/phpunit/phpunit --testsuite DevTools" ], + "test-lte9": [ + "@php ./vendor/phpunit/phpunit/phpunit -c phpunitlte9.xml.dist" + ], + "test-sniff-lte9": [ + "@php ./vendor/phpunit/phpunit/phpunit -c phpunitlte9.xml.dist --testsuite DebugSniff" + ], + "test-tools-lte9": [ + "@php ./vendor/phpunit/phpunit/phpunit -c phpunitlte9.xml.dist --testsuite DevTools" + ], "check-complete": [ "@php ./bin/phpcs-check-feature-completeness ./PHPCSDebug" ] diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 7b0a2a1..7d6b0d9 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,16 +1,25 @@ + xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" + backupGlobals="true" + bootstrap="./phpunit-bootstrap.php" + beStrictAboutTestsThatDoNotTestAnything="false" + cacheDirectory="build/phpunit-cache" + colors="true" + displayDetailsOnTestsThatTriggerErrors="true" + displayDetailsOnTestsThatTriggerWarnings="true" + displayDetailsOnTestsThatTriggerNotices="true" + displayDetailsOnTestsThatTriggerDeprecations="true" + displayDetailsOnIncompleteTests="true" + displayDetailsOnSkippedTests="true" + displayDetailsOnPhpunitDeprecations="false" + failOnWarning="true" + failOnNotice="true" + failOnDeprecation="true" + failOnPhpunitDeprecation="false" + requireCoverageMetadata="true" + > diff --git a/phpunitlte9.xml.dist b/phpunitlte9.xml.dist new file mode 100644 index 0000000..7b0a2a1 --- /dev/null +++ b/phpunitlte9.xml.dist @@ -0,0 +1,23 @@ + + + + + + ./PHPCSDebug/Tests/ + + + ./Tests/DocsXsd/ + + +