From 053b49c2c4905fa183d167733fcad25e5fd95cf0 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Fri, 6 Nov 2026 22:00:10 +0800 Subject: [PATCH] chore: cleanup phpunit --- .gitattributes | 2 +- .github/workflows/phpunit-lang.yml | 30 ++++++++++---------- .github/workflows/phpunit-lowest.yml | 8 +++--- .github/workflows/phpunit.yml | 8 +++--- .gitignore | 2 +- composer.json | 2 ++ docs/references/testing.md | 4 +-- phpunit.xml.dist => phpunit.dist.xml | 42 ++++++++++------------------ 8 files changed, 42 insertions(+), 56 deletions(-) rename phpunit.xml.dist => phpunit.dist.xml (77%) diff --git a/.gitattributes b/.gitattributes index 8fb160e28..95f18d8ed 100644 --- a/.gitattributes +++ b/.gitattributes @@ -12,7 +12,7 @@ /mkdocs.yml export-ignore /phpstan-baseline.php export-ignore /phpstan.neon.dist export-ignore -/phpunit.xml.dist export-ignore +/phpunit.dist.xml export-ignore /pyrameter.php export-ignore /psalm_autoload.php export-ignore /psalm-baseline.xml export-ignore diff --git a/.github/workflows/phpunit-lang.yml b/.github/workflows/phpunit-lang.yml index 2f6196088..73d0a539c 100644 --- a/.github/workflows/phpunit-lang.yml +++ b/.github/workflows/phpunit-lang.yml @@ -7,7 +7,7 @@ on: paths: - 'src/Language/**.php' - '!src/Language/en/**.php' - - 'phpunit*' + - 'phpunit.dist.xml' - '.github/workflows/phpunit-lang.yml' - 'tests/Language/AbstractTranslationTestCase.php' push: @@ -16,7 +16,7 @@ on: paths: - 'src/Language/**.php' - '!src/Language/en/**.php' - - 'phpunit*' + - 'phpunit.dist.xml' - '.github/workflows/phpunit-lang.yml' - 'tests/Language/AbstractTranslationTestCase.php' @@ -29,37 +29,35 @@ jobs: steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Set up PHP uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # v2.40.0 with: php-version: '8.2' - tools: composer, phive, phpunit - extensions: intl, json, mbstring, gd, xdebug, xml, sqlite3 - coverage: xdebug + coverage: none env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Get composer cache directory - run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache composer dependencies uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 #v6.1.0 with: - path: ${{ env.COMPOSER_CACHE_FILES_DIR }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ runner.os }}-composer- + path: ${{ steps.composer-cache.outputs.dir }} + key: composer-8.2-${{ hashFiles('**/composer.json') }} + restore-keys: | + composer-8.2- + composer- - name: Install dependencies - run: | - if [ -f composer.lock ]; then - composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader - else - composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader - fi + run: composer update --ansi - name: Test with PHPUnit - run: vendor/bin/phpunit --no-coverage --testsuite lang + run: vendor/bin/phpunit --no-coverage tests/Language env: TERM: xterm-256color TACHYCARDIA_MONITOR_GA: enabled diff --git a/.github/workflows/phpunit-lowest.yml b/.github/workflows/phpunit-lowest.yml index f9af38c22..cb3e7ae8b 100644 --- a/.github/workflows/phpunit-lowest.yml +++ b/.github/workflows/phpunit-lowest.yml @@ -6,16 +6,16 @@ on: - develop paths: - '**.php' - - 'composer.*' - - 'phpunit*' + - 'composer.json' + - 'phpunit.dist.xml' - '.github/workflows/phpunit-lowest.yml' push: branches: - develop paths: - '**.php' - - 'composer.*' - - 'phpunit*' + - 'composer.json' + - 'phpunit.dist.xml' - '.github/workflows/phpunit-lowest.yml' jobs: diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index a521e1bf3..3bd4e0437 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -6,16 +6,16 @@ on: - develop paths: - '**.php' - - 'composer.*' - - 'phpunit*' + - 'composer.json' + - 'phpunit.dist.xml' - '.github/workflows/phpunit.yml' push: branches: - develop paths: - '**.php' - - 'composer.*' - - 'phpunit*' + - 'composer.json' + - 'phpunit.dist.xml' - '.github/workflows/phpunit.yml' jobs: diff --git a/.gitignore b/.gitignore index 00ffd45bd..85d434a2d 100644 --- a/.gitignore +++ b/.gitignore @@ -106,7 +106,7 @@ nb-configuration.xml .vscode/ /results/ -/phpunit*.xml +/phpunit.xml /.phpunit.*.cache /.php-cs-fixer.php diff --git a/composer.json b/composer.json index 9a34e76c8..dccce76c3 100644 --- a/composer.json +++ b/composer.json @@ -68,6 +68,8 @@ "infection/extension-installer": true, "phpstan/extension-installer": true }, + "preferred-install": "dist", + "optimize-autoloader": true, "sort-packages": true }, "scripts": { diff --git a/docs/references/testing.md b/docs/references/testing.md index 67a993c41..83d526127 100644 --- a/docs/references/testing.md +++ b/docs/references/testing.md @@ -38,11 +38,11 @@ class ActionsTest extends TestCase By default, Shield has set the `Config\Auth::$hashCost = 12` due to the greater security of passwords. However, to increase the test execution time, we have set the `$hashCost = 4` for the test environment. -If you use Shield in your project and your tests execution time is high, just set the `$hashCost = 4` in file **phpunit.xml.dist** of your project as follows: +If you use Shield in your project and your tests execution time is high, just set the `$hashCost = 4` in file **phpunit.dist.xml** of your project as follows: ``` -``` \ No newline at end of file +``` diff --git a/phpunit.xml.dist b/phpunit.dist.xml similarity index 77% rename from phpunit.xml.dist rename to phpunit.dist.xml index e406d54f0..653cacae3 100644 --- a/phpunit.xml.dist +++ b/phpunit.dist.xml @@ -1,26 +1,29 @@ + beStrictAboutCoverageMetadata="true" +> + + + ./src/ + + + ./src/Config + ./src/Views + ./src/Language + + - - - - @@ -36,11 +39,6 @@ - - - - - @@ -52,8 +50,6 @@ - - @@ -67,14 +63,4 @@ --> - - - ./src/ - - - ./src/Config - ./src/Views - ./src/Language - -