43 lines
1.3 KiB
PHP
43 lines
1.3 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace Tests\Feature;
|
||
|
|
|
||
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||
|
|
use Tests\TestCase;
|
||
|
|
|
||
|
|
class AdminRouteTest extends TestCase
|
||
|
|
{
|
||
|
|
use RefreshDatabase;
|
||
|
|
/**
|
||
|
|
* A basic feature test for the admin route.
|
||
|
|
*/
|
||
|
|
public function test_admin_route_is_accessible_via_loom(): void
|
||
|
|
{
|
||
|
|
$this->seed(\Database\Seeders\RoleSeeder::class);
|
||
|
|
$user = \App\Models\User::factory()->create();
|
||
|
|
$user->roles()->attach(\App\Models\Role::where('slug', 'admin')->first());
|
||
|
|
|
||
|
|
// Default ADMIN_PATH is 'loom'
|
||
|
|
$response = $this->actingAs($user)->get('/loom');
|
||
|
|
|
||
|
|
$response->assertStatus(200);
|
||
|
|
$response->assertSee('data-component="Dashboard"', false);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Test that the admin route follows the .env config.
|
||
|
|
*/
|
||
|
|
public function test_admin_route_respects_env_config(): void
|
||
|
|
{
|
||
|
|
$this->seed(\Database\Seeders\RoleSeeder::class);
|
||
|
|
$user = \App\Models\User::factory()->create();
|
||
|
|
$user->roles()->attach(\App\Models\Role::where('slug', 'admin')->first());
|
||
|
|
|
||
|
|
$adminPath = env('ADMIN_PATH', 'loom');
|
||
|
|
$response = $this->actingAs($user)->get('/' . $adminPath);
|
||
|
|
|
||
|
|
$response->assertStatus(200);
|
||
|
|
$response->assertSee('data-component="Dashboard"', false);
|
||
|
|
}
|
||
|
|
}
|