add all controllers logic

This commit is contained in:
root
2026-03-11 17:53:15 -04:00
parent 3e6c577085
commit 2ef71cc92b
421 changed files with 12009 additions and 5211 deletions
@@ -0,0 +1,57 @@
<?php
namespace Tests\Unit\Services\Frontend;
use App\Models\User;
use App\Services\Frontend\LandingPageService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\DB;
use Tests\TestCase;
class LandingPageServiceTest extends TestCase
{
use RefreshDatabase;
public function test_dashboard_for_user_returns_guest(): void
{
$service = app(LandingPageService::class);
$payload = $service->dashboardForUser(null);
$this->assertSame('guest', $payload['role']);
}
public function test_dashboard_for_user_returns_admin(): void
{
$roleId = DB::table('roles')->insertGetId([
'name' => 'admin',
'priority' => 1,
'is_active' => 1,
]);
$user = User::query()->create([
'firstname' => 'Admin',
'lastname' => 'User',
'email' => 'admin@example.com',
'cellphone' => '5555555555',
'address_street' => '123 Main',
'city' => 'City',
'state' => 'ST',
'zip' => '12345',
'accept_school_policy' => 1,
'status' => 'Active',
'password' => bcrypt('secret'),
'semester' => 'Fall',
'school_year' => '2025-2026',
]);
DB::table('user_roles')->insert([
'user_id' => $user->id,
'role_id' => $roleId,
]);
$service = app(LandingPageService::class);
$payload = $service->dashboardForUser($user);
$this->assertSame('admin', $payload['role']);
}
}