Files
KanbanGit/tests/Feature/WelcomeTest.php
T

46 lines
1.3 KiB
PHP

<?php
namespace Tests\Feature;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Inertia\Testing\AssertableInertia as Assert;
use Symfony\Component\Process\Process;
use Tests\TestCase;
class WelcomeTest extends TestCase
{
use RefreshDatabase;
public function test_public_entry_page_is_available_to_guests(): void
{
$this->get(route('home'))
->assertOk()
->assertInertia(fn (Assert $page) => $page
->component('Welcome')
->where('auth.user', null));
}
public function test_public_entry_page_recognizes_authenticated_users(): void
{
$user = User::factory()->create();
$this->actingAs($user)
->get(route('home'))
->assertOk()
->assertInertia(fn (Assert $page) => $page
->component('Welcome')
->where('auth.user.id', $user->id));
}
public function test_public_entry_page_presentation_and_localization(): void
{
$process = new Process(['node', 'tests/Fixtures/welcome.mjs'], base_path());
$process->setTimeout(60);
$process->run();
$this->assertTrue($process->isSuccessful(), $process->getOutput().$process->getErrorOutput());
$this->assertStringContainsString('Welcome behavior checks passed.', $process->getOutput());
}
}