add all controllers logic
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Services\Preferences;
|
||||
|
||||
use App\Services\Preferences\PreferencesCommandService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class PreferencesCommandServiceTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_upsert_creates_record(): void
|
||||
{
|
||||
$service = app(PreferencesCommandService::class);
|
||||
$pref = $service->upsert(1, [
|
||||
'receive_email_notifications' => true,
|
||||
'receive_sms_notifications' => false,
|
||||
'theme' => 'light',
|
||||
'language' => 'en',
|
||||
]);
|
||||
|
||||
$this->assertSame(1, $pref->user_id);
|
||||
$this->assertDatabaseHas('user_preferences', [
|
||||
'user_id' => 1,
|
||||
'notification_email' => 1,
|
||||
'notification_sms' => 0,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user