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.
30 lines
821 B
PHP
30 lines
821 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
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']);
|
|
});
|
|
});
|