2FAuth/tests/Feature/Console/CheckDbConnectionTest.php

34 lines
845 B
PHP
Raw Normal View History

2021-11-30 17:39:33 +01:00
<?php
namespace Tests\Feature\Console;
2023-08-01 11:28:27 +02:00
use App\Console\Commands\CheckDbConnection;
2021-11-30 17:39:33 +01:00
use Illuminate\Support\Facades\DB;
2023-08-01 11:28:27 +02:00
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Test;
2022-11-22 15:15:52 +01:00
use Tests\FeatureTestCase;
2021-11-30 17:39:33 +01:00
/**
2023-08-01 11:28:27 +02:00
* CheckDbConnectionTest test class
2021-11-30 17:39:33 +01:00
*/
2023-08-01 11:28:27 +02:00
#[CoversClass(CheckDbConnection::class)]
2021-11-30 17:39:33 +01:00
class CheckDbConnectionTest extends FeatureTestCase
{
#[Test]
2021-11-30 17:39:33 +01:00
public function test_CheckDbConnection_ends_successfully()
{
$this->artisan('2fauth:check-db-connection')
->assertExitCode(1);
}
// #[Test]
2023-09-26 08:40:36 +02:00
// public function test_CheckDbConnection_without_db_returns_false()
// {
// DB::shouldReceive('connection', 'getPDO')
// ->andThrow(new \Exception());
2021-11-30 17:39:33 +01:00
2023-09-26 08:40:36 +02:00
// $this->artisan('2fauth:check-db-connection')
// ->assertExitCode(0);
// }
2022-11-22 15:15:52 +01:00
}