fixes
This commit is contained in:
29
tests/Feature/DashboardGalleryTest.php
Normal file
29
tests/Feature/DashboardGalleryTest.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\Artwork;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class DashboardGalleryTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
public function test_guest_is_redirected_from_dashboard_gallery(): void
|
||||
{
|
||||
$this->get('/dashboard/gallery')->assertRedirect('/login');
|
||||
}
|
||||
|
||||
public function test_authenticated_user_sees_gallery(): void
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
$art = Artwork::factory()->create(['user_id' => $user->id, 'title' => 'Test Artwork']);
|
||||
|
||||
$this->actingAs($user)
|
||||
->get(route('dashboard.gallery'))
|
||||
->assertOk()
|
||||
->assertSee('My Gallery')
|
||||
->assertSee('Test Artwork');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user