36 lines
962 B
PHP
36 lines
962 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Integration\WithApp\App\Cqs\Actions\Settings;
|
|
|
|
use App\Cqs\Actions\Settings\UpdateSettings;
|
|
use App\Cqs\Actions\Settings\UpdateSettingsInput;
|
|
use App\Models\Setting;
|
|
use Domain\Models\ValueObjects\ShopperSiteCode;
|
|
|
|
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->employee_sites)->toBe(['PA', 'LY']);
|
|
|
|
$this->assertDatabaseHas('settings', [
|
|
'id' => Setting::SINGLETON_ID,
|
|
]);
|
|
|
|
$fresh = Setting::getSingleton();
|
|
expect($fresh->employee_sites)->toBe(['PA', 'LY']);
|
|
});
|
|
});
|