32 lines
884 B
PHP
32 lines
884 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Integration\WithApp\App\Cqs\Queries\Settings;
|
|
|
|
use App\Contracts\QueryInputEmpty;
|
|
use App\Cqs\Queries\Settings\GetSettingsQuery;
|
|
use App\Dto\SettingDto;
|
|
use App\Models\Setting;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
describe('GetSettingsQuery', function (): void {
|
|
it('returns settings as SettingDto', function (): void {
|
|
// GIVEN
|
|
$setting = Setting::getSingleton();
|
|
$setting->employee_sites = ['NA', 'BO'];
|
|
$setting->saveOrFail();
|
|
|
|
$query = new GetSettingsQuery();
|
|
|
|
// WHEN
|
|
$dto = $query(new QueryInputEmpty());
|
|
|
|
// THEN
|
|
expect($dto)->toBeInstanceOf(SettingDto::class)
|
|
->and($dto->id)->toBe(Setting::SINGLETON_ID)
|
|
->and($dto->employeeSites)->toBe(['NA', 'BO']);
|
|
});
|
|
});
|