38 lines
1.2 KiB
PHP
38 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Spatie\Permission\Models\Role;
|
|
use Tests\TestCase;
|
|
|
|
class AccountAndAdminRoutesTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_authenticated_account_pages_render(): void
|
|
{
|
|
$user = User::factory()->create();
|
|
|
|
foreach (['/dashboard', '/account/enquiries', '/account/bookings', '/account/profile'] as $uri) {
|
|
$this->actingAs($user)->get($uri)->assertSuccessful();
|
|
}
|
|
}
|
|
|
|
public function test_all_admin_pages_render_for_admin(): void
|
|
{
|
|
Role::create(['name' => 'admin', 'guard_name' => 'web']);
|
|
$admin = User::factory()->create();
|
|
$admin->assignRole('admin');
|
|
|
|
$sections = ['users', 'clients', 'djs', 'businesses', 'bookings', 'payments', 'reviews', 'messages', 'notifications', 'support', 'reports', 'content', 'roles', 'privacy', 'settings'];
|
|
|
|
$this->actingAs($admin)->get('/admin')->assertSuccessful();
|
|
foreach ($sections as $section) {
|
|
$this->actingAs($admin)->get('/admin/'.$section)->assertSuccessful();
|
|
$this->actingAs($admin)->get('/admin/'.$section.'/create')->assertSuccessful();
|
|
}
|
|
}
|
|
}
|