ldc-cocotte/tests/Integration/WithApp/App/Actions/Settings/UpdateSettingsTest.php
Jérémy Munsch d0efb0f527
refactor: update namespaces for actions and queries
Refactored the codebase to change the namespaces of various actions and queries from `App\Actions` to `App\Cqs\Actions` and `App\Queries` to `App\Cqs\Queries`. This restructuring improves organization and clarity in the codebase.
2026-11-10 15:13:26 +01:00

38 lines
1 KiB
PHP

<?php
declare(strict_types=1);
use App\Cqs\Actions\Settings\UpdateSettings;
use App\Cqs\Actions\Settings\UpdateSettingsInput;
use App\Models\Setting;
use Domain\Models\ValueObjects\ShopperSiteCode;
use Illuminate\Foundation\Testing\RefreshDatabase;
uses(RefreshDatabase::class);
describe('UpdateSettings', function (): void {
it('updates employee sites configuration', function (): void {
/** @var \Tests\TestCase $this */
// GIVEN
$action = new UpdateSettings();
$input = new UpdateSettingsInput([
new ShopperSiteCode('PA'),
new ShopperSiteCode('LY'),
]);
// WHEN
$setting = $action($input);
// THEN
expect($setting)->toBeInstanceOf(Setting::class)
->and($setting->employee_sites)->toBe(['PA', 'LY']);
$this->assertDatabaseHas('settings', [
'id' => Setting::SINGLETON_ID,
]);
$fresh = Setting::getSingleton();
expect($fresh->employee_sites)->toBe(['PA', 'LY']);
});
});