40 lines
980 B
PHP
40 lines
980 B
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Livewire\Help\Index;
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Livewire\Livewire;
|
|
use Tests\TestCase;
|
|
|
|
class HelpPageTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
private function actAsAdmin(): void
|
|
{
|
|
$this->actingAs(User::factory()->create(['must_change_password' => false]));
|
|
}
|
|
|
|
public function test_help_route_loads_for_an_authenticated_admin(): void
|
|
{
|
|
$this->actAsAdmin();
|
|
$this->get('/help')->assertOk();
|
|
}
|
|
|
|
public function test_default_topic_is_overview(): void
|
|
{
|
|
$this->actAsAdmin();
|
|
Livewire::test(Index::class)
|
|
->assertSet('topic', 'overview')
|
|
->assertSee(__('help.topic_overview'));
|
|
}
|
|
|
|
public function test_unknown_topic_falls_back_to_overview(): void
|
|
{
|
|
$this->actAsAdmin();
|
|
Livewire::test(Index::class, ['topic' => 'bogus'])->assertSet('topic', 'overview');
|
|
}
|
|
}
|