From 82bdfdb5a0c1404041c1b1e39c14a91ce1590311 Mon Sep 17 00:00:00 2001 From: Aleksei Gagarin Date: Tue, 4 Jun 2024 00:10:32 +0400 Subject: [PATCH] ci: use pest for arch tests only; phpunit for unit tests without limitations (#114) --- .github/workflows/testing.yml | 6 +++--- composer.json | 9 +++----- pest.xml.dist | 30 ++++++++++++++++++++++++++ phpunit.xml.dist | 3 --- tests/Unit/Client/FunctionTrapTest.php | 2 -- tests/Unit/Client/TrTest.php | 2 -- 6 files changed, 36 insertions(+), 16 deletions(-) create mode 100644 pest.xml.dist diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 0f9d82a5..a426ef00 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -129,11 +129,11 @@ jobs: with: dependencies: ${{ matrix.dependencies }} - - name: 🧪 Run unit tests using pestphp/pest + - name: 🧪 Run unit tests using phpunit/phpunit run: composer test - - name: 🧪 Run tests that require separate process using phpunit/phpunit - run: composer test:sep + - name: 🧪 Run arch tests using pestphp/pest + run: composer test:arch compile-phar: timeout-minutes: 4 diff --git a/composer.json b/composer.json index 6e3dd385..5b8ba89c 100644 --- a/composer.json +++ b/composer.json @@ -128,15 +128,12 @@ "stan:ci": "phpstan analyse --memory-limit=2G --error-format=github", "test": [ "@putenv XDEBUG_MODE=coverage", - "pest --exclude-group=phpunit-only --color=always" + "phpunit --color=always" ], + "test:arch": "pest --color=always --configuration pest.xml.dist", "test:cc": [ "@putenv XDEBUG_MODE=coverage", - "pest --coverage --coverage-clover=.build/phpunit/logs/clover.xml --exclude-group=phpunit-only --color=always" - ], - "test:sep": [ - "@putenv XDEBUG_MODE=coverage", - "phpunit --group=phpunit-only --color=always --exclude-testsuite=Arch" + "phpunit --coverage-clover=.build/phpunit/logs/clover.xml --color=always" ] } } diff --git a/pest.xml.dist b/pest.xml.dist new file mode 100644 index 00000000..2d40f524 --- /dev/null +++ b/pest.xml.dist @@ -0,0 +1,30 @@ + + + + + + + + tests/Arch + + + + + src + + + tests + src/Test + + + diff --git a/phpunit.xml.dist b/phpunit.xml.dist index c80bb641..447a7e3c 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -17,9 +17,6 @@ tests/Unit - - tests/Arch - diff --git a/tests/Unit/Client/FunctionTrapTest.php b/tests/Unit/Client/FunctionTrapTest.php index 51c51196..bbbd5469 100644 --- a/tests/Unit/Client/FunctionTrapTest.php +++ b/tests/Unit/Client/FunctionTrapTest.php @@ -4,14 +4,12 @@ namespace Buggregator\Trap\Tests\Unit\Client; -use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\Attributes\RunInSeparateProcess; use PHPUnit\Framework\TestCase; final class FunctionTrapTest extends TestCase { #[RunInSeparateProcess] - #[Group('phpunit-only')] public function testLeak(): void { $object = new \stdClass(); diff --git a/tests/Unit/Client/TrTest.php b/tests/Unit/Client/TrTest.php index 0ce8b85b..62ae2f01 100644 --- a/tests/Unit/Client/TrTest.php +++ b/tests/Unit/Client/TrTest.php @@ -5,7 +5,6 @@ namespace Buggregator\Trap\Tests\Unit\Client; use Buggregator\Trap\Client\TrapHandle\Dumper; -use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\Attributes\RunInSeparateProcess; use Symfony\Component\VarDumper\Dumper\DataDumperInterface; @@ -21,7 +20,6 @@ public function testLabel(): void * Check the stacktrace contains three items and it begins with the right function name. */ #[RunInSeparateProcess] - #[Group('phpunit-only')] public function testTrAsStackTrace(): void { tr();