add role permission logic
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Services\Roles;
|
||||
|
||||
use App\Services\Roles\RoleDashboardService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Tests\TestCase;
|
||||
|
||||
class RoleDashboardServiceTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_best_dashboard_route_for_returns_route(): void
|
||||
{
|
||||
DB::table('roles')->insert([
|
||||
'name' => 'admin',
|
||||
'slug' => 'admin',
|
||||
'description' => 'Admin',
|
||||
'dashboard_route' => 'administrator/administratordashboard',
|
||||
'priority' => 1,
|
||||
'is_active' => 1,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
$service = new RoleDashboardService();
|
||||
$route = $service->bestDashboardRouteFor(['admin']);
|
||||
|
||||
$this->assertSame('administrator/administratordashboard', $route);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user