45 lines
1.2 KiB
PHP
45 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Tests\Unit\Services\Ui;
|
|
|
|
use App\Models\User;
|
|
use App\Services\Ui\UiStyleService;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
class UiStyleServiceTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_update_creates_preferences(): void
|
|
{
|
|
$user = User::query()->create([
|
|
'firstname' => 'Test',
|
|
'lastname' => 'User',
|
|
'email' => 'ui@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',
|
|
]);
|
|
|
|
$service = new UiStyleService;
|
|
$prefs = $service->update($user->id, [
|
|
'accent' => 'blue',
|
|
'menu' => 'custom',
|
|
'menu_bg' => '#112233',
|
|
'menu_text' => '#ffffff',
|
|
'menu_mode' => 'dark',
|
|
]);
|
|
|
|
$this->assertSame('blue', $prefs->style_color);
|
|
$this->assertSame('custom', $prefs->menu_color);
|
|
}
|
|
}
|