Fix for tests

This commit is contained in:
Constantin Graf
2024-10-29 14:37:21 +01:00
parent a70c4fe3fb
commit 3c61303d88

View File

@@ -11,11 +11,11 @@ use Illuminate\Http\Client\ConnectionException;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Http;
use PHPUnit\Framework\Attributes\CoversClass;
use Tests\TestCase;
use Tests\TestCaseWithDatabase;
#[CoversClass(SelfHostTelemetryCommand::class)]
#[CoversClass(ApiService::class)]
class SelfHostTelemetryCommandTest extends TestCase
class SelfHostTelemetryCommandTest extends TestCaseWithDatabase
{
public function test_telemetry_sends_data_to_telemetry_endpoint_of_solidtime_cloud(): void
{
@@ -28,9 +28,12 @@ class SelfHostTelemetryCommandTest extends TestCase
$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