39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Livewire\System\Index;
|
|
use App\Models\User;
|
|
use App\Services\DeploymentService;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Livewire\Livewire;
|
|
use Tests\TestCase;
|
|
|
|
class TlsModeToggleTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_applying_external_mode_persists_and_flags_restart(): void
|
|
{
|
|
$this->actingAs(User::factory()->create(['must_change_password' => false]));
|
|
|
|
Livewire::test(Index::class)
|
|
->call('applyTlsMode', 'external', app(DeploymentService::class))
|
|
->assertSet('tlsMode', 'external')
|
|
->assertSet('restartPending', true);
|
|
|
|
$this->assertTrue(app(DeploymentService::class)->externalTls());
|
|
}
|
|
|
|
public function test_invalid_mode_is_ignored(): void
|
|
{
|
|
$this->actingAs(User::factory()->create(['must_change_password' => false]));
|
|
|
|
Livewire::test(Index::class)
|
|
->call('applyTlsMode', 'garbage', app(DeploymentService::class))
|
|
->assertSet('tlsMode', 'caddy');
|
|
|
|
$this->assertFalse(app(DeploymentService::class)->externalTls());
|
|
}
|
|
}
|