build: initialize RetroHub with Laravel, Inertia, Vue, and Horizon
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Features\Consoles\Models\Console;
|
||||
use App\Features\Games\Models\Game;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ConsoleTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_consoles_index_requires_authentication(): void
|
||||
{
|
||||
$this->get(route('consoles.index'))->assertRedirect(route('login'));
|
||||
}
|
||||
|
||||
public function test_consoles_index_can_be_rendered(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
|
||||
$this->actingAs($user)
|
||||
->get(route('consoles.index'))
|
||||
->assertOk();
|
||||
}
|
||||
|
||||
public function test_consoles_index_shows_consoles(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
Console::factory()->count(3)->create();
|
||||
|
||||
$this->actingAs($user)
|
||||
->get(route('consoles.index'))
|
||||
->assertOk();
|
||||
}
|
||||
|
||||
public function test_console_show_requires_authentication(): void
|
||||
{
|
||||
$console = Console::factory()->create();
|
||||
|
||||
$this->get(route('consoles.show', $console->slug))
|
||||
->assertRedirect(route('login'));
|
||||
}
|
||||
|
||||
public function test_console_show_can_be_rendered(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$console = Console::factory()->create();
|
||||
|
||||
$this->actingAs($user)
|
||||
->get(route('consoles.show', $console->slug))
|
||||
->assertOk();
|
||||
}
|
||||
|
||||
public function test_console_show_with_games(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$console = Console::factory()->create();
|
||||
Game::factory()->count(5)->create(['console_id' => $console->id]);
|
||||
|
||||
$this->actingAs($user)
|
||||
->get(route('consoles.show', $console->slug))
|
||||
->assertOk();
|
||||
}
|
||||
|
||||
public function test_console_show_returns_404_for_invalid_slug(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
|
||||
$this->actingAs($user)
|
||||
->get(route('consoles.show', 'nonexistent'))
|
||||
->assertNotFound();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user