Skip to content

Commit

Permalink
ci: use pest for arch tests only; phpunit for unit tests without limi…
Browse files Browse the repository at this point in the history
…tations
  • Loading branch information
roxblnfk committed Jun 2, 2024
1 parent 18f07e6 commit db18fce
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 16 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 3 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:cc": [
"@putenv XDEBUG_MODE=coverage",
"pest --coverage --coverage-clover=.build/phpunit/logs/clover.xml --exclude-group=phpunit-only --color=always"
"phpunit --coverage-clover=.build/phpunit/logs/clover.xml --color=always"
],
"test:sep": [
"@putenv XDEBUG_MODE=coverage",
"phpunit --group=phpunit-only --color=always --exclude-testsuite=Arch"
]
"test:arch": "pest --color=always --configuration pest.xml.dist"
}
}
30 changes: 30 additions & 0 deletions pest.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
cacheResultFile=".build/phpunit/result.cache"
failOnWarning="true"
failOnRisky="true"
executionOrder="random"
stderr="true"
beStrictAboutOutputDuringTests="true"
>
<extensions>
<bootstrap class="Ergebnis\PHPUnit\SlowTestDetector\Extension"/>
</extensions>
<testsuites>
<testsuite name="Arch">
<directory>tests/Arch</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>src</directory>
</include>
<exclude>
<directory>tests</directory>
<directory>src/Test</directory>
</exclude>
</source>
</phpunit>
3 changes: 0 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="Arch">
<directory>tests/Arch</directory>
</testsuite>
</testsuites>
<coverage>
<report>
Expand Down
2 changes: 0 additions & 2 deletions tests/Unit/Client/FunctionTrapTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 0 additions & 2 deletions tests/Unit/Client/TrTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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();
Expand Down

0 comments on commit db18fce

Please sign in to comment.