From 13180e58630c803b612a0de82ef563acb151ae85 Mon Sep 17 00:00:00 2001 From: Constantin Graf Date: Tue, 29 Oct 2024 14:37:21 +0100 Subject: [PATCH] Fix for tests --- .../Commands/SelfHost/SelfHostTelemetryCommandTest.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/Unit/Console/Commands/SelfHost/SelfHostTelemetryCommandTest.php b/tests/Unit/Console/Commands/SelfHost/SelfHostTelemetryCommandTest.php index be436152..112d54d0 100644 --- a/tests/Unit/Console/Commands/SelfHost/SelfHostTelemetryCommandTest.php +++ b/tests/Unit/Console/Commands/SelfHost/SelfHostTelemetryCommandTest.php @@ -10,14 +10,16 @@ use Illuminate\Http\Client\ConnectionException; use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Http; +use Illuminate\Support\Facades\Log; 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 +32,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