From 96acd4b9621231fd258e4ee2da3d3a8c970a40d8 Mon Sep 17 00:00:00 2001 From: Constantin Graf Date: Wed, 18 Sep 2024 22:03:37 +0200 Subject: [PATCH 1/2] Add parallel testing to GitHub action phpunit --- .github/workflows/phpunit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 2dc92778..d2724d62 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -60,7 +60,7 @@ jobs: php artisan passport:keys - name: "Run PHPUnit" - run: php artisan test --stop-on-failure --coverage-text --coverage-clover=coverage.xml + run: php artisan test --parallel --stop-on-failure --coverage-text --coverage-clover=coverage.xml - name: "Upload coverage reports to Codecov" uses: codecov/codecov-action@v5.4.2 From 7ae4f2171daaa2a35d812a9e658c82528ac7ab79 Mon Sep 17 00:00:00 2001 From: Constantin Graf Date: Tue, 29 Oct 2024 14:37:21 +0100 Subject: [PATCH 2/2] Fix for tests --- .../Commands/SelfHost/SelfHostTelemetryCommandTest.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/Unit/Console/Commands/SelfHost/SelfHostTelemetryCommandTest.php b/tests/Unit/Console/Commands/SelfHost/SelfHostTelemetryCommandTest.php index be436152..7d40081b 100644 --- a/tests/Unit/Console/Commands/SelfHost/SelfHostTelemetryCommandTest.php +++ b/tests/Unit/Console/Commands/SelfHost/SelfHostTelemetryCommandTest.php @@ -12,12 +12,12 @@ use Illuminate\Support\Facades\Http; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\UsesClass; -use Tests\TestCase; +use Tests\TestCaseWithDatabase; #[CoversClass(SelfHostTelemetryCommand::class)] #[CoversClass(ApiService::class)] #[UsesClass(SelfHostTelemetryCommand::class)] -class SelfHostTelemetryCommandTest extends TestCase +class SelfHostTelemetryCommandTest extends TestCaseWithDatabase { public function test_telemetry_sends_data_to_telemetry_endpoint_of_solidtime_cloud(): void { @@ -30,9 +30,12 @@ public function test_telemetry_sends_data_to_telemetry_endpoint_of_solidtime_clo $exitCode = $this->withoutMockingConsoleOutput()->artisan('self-host:telemetry'); // Assert - $this->assertSame(Command::SUCCESS, $exitCode); $output = Artisan::output(); $this->assertSame('', $output); + if ($exitCode !== Command::SUCCESS) { + dump($output); + } + $this->assertSame(Command::SUCCESS, $exitCode); } public function test_telemetry_sends_fails_gracefully_if_response_has_error_status_code(): void