updates for admin area
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?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', 'djs', 'clients', '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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Http\Middleware\PreventRequestForgery;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Tests\TestCase;
|
||||
@@ -11,6 +12,12 @@ class AuthenticationTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->withoutMiddleware(PreventRequestForgery::class);
|
||||
}
|
||||
|
||||
public function test_user_can_register(): void
|
||||
{
|
||||
Role::create(['name' => 'client', 'guard_name' => 'web']);
|
||||
|
||||
Reference in New Issue
Block a user