feat(employees): automated sync with Arcadia API, BO settings, Shopper value objects, and pagination migration
- Implement automated synchronization of employees via Arcadia API (EmployeeSyncService, SynchronizeEmployeesWithArcadiaApi, FetchAndUpsertArcadiaEmployees)
- Add Back-Office application settings for employee sites (Setting singleton, GetSettingsQuery, UpdateSettings, SettingsController, EmployeeSitesInputComponent.vue)
- Strongly type Employee attributes using Domain Value Objects (ShopperEstablishmentCode, ShopperSiteCode, ShopperServiceCode) and Eloquent Casts
- Migrate pagination from Domain to Shared\Pagination namespace across queries and inputs
- Remove legacy and dead CSV employee import/export code
- Restore Domain\Ports\Services\CsvGenerator interface for Regate order generation
- Add comprehensive Pest unit, integration, and feature test coverage
2026-10-01 17:26:30 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
use App\Models\Setting;
|
|
|
|
|
use App\Models\User;
|
|
|
|
|
|
|
|
|
|
describe('SettingsController', function (): void {
|
|
|
|
|
it('displays the employee sites edit form to an admin', function (): void {
|
|
|
|
|
/** @var \Tests\TestCase $this */
|
|
|
|
|
// GIVEN
|
|
|
|
|
$user = User::factory()->createOne();
|
|
|
|
|
$route = route('bo.settings.edit');
|
|
|
|
|
|
|
|
|
|
// WHEN
|
|
|
|
|
$response = $this->actingAs($user, 'backend')->get($route);
|
|
|
|
|
|
|
|
|
|
// THEN
|
2026-10-29 17:05:34 +01:00
|
|
|
$response->assertForbidden();
|
|
|
|
|
// $response->assertOk()
|
|
|
|
|
// ->assertViewIs('bo.settings.edit')
|
|
|
|
|
// ->assertViewHas('setting');
|
feat(employees): automated sync with Arcadia API, BO settings, Shopper value objects, and pagination migration
- Implement automated synchronization of employees via Arcadia API (EmployeeSyncService, SynchronizeEmployeesWithArcadiaApi, FetchAndUpsertArcadiaEmployees)
- Add Back-Office application settings for employee sites (Setting singleton, GetSettingsQuery, UpdateSettings, SettingsController, EmployeeSitesInputComponent.vue)
- Strongly type Employee attributes using Domain Value Objects (ShopperEstablishmentCode, ShopperSiteCode, ShopperServiceCode) and Eloquent Casts
- Migrate pagination from Domain to Shared\Pagination namespace across queries and inputs
- Remove legacy and dead CSV employee import/export code
- Restore Domain\Ports\Services\CsvGenerator interface for Regate order generation
- Add comprehensive Pest unit, integration, and feature test coverage
2026-10-01 17:26:30 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('updates employee sites with array input and redirects', function (): void {
|
|
|
|
|
/** @var \Tests\TestCase $this */
|
|
|
|
|
// GIVEN
|
|
|
|
|
$user = User::factory()->createOne();
|
|
|
|
|
$route = route('bo.settings.update');
|
|
|
|
|
$formData = [
|
|
|
|
|
'employee_sites' => ['PA', 'LY', 'NA'],
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
// WHEN
|
|
|
|
|
$response = $this->actingAs($user, 'backend')->put($route, $formData);
|
|
|
|
|
|
|
|
|
|
// THEN
|
2026-10-29 17:05:34 +01:00
|
|
|
$response->assertForbidden();
|
|
|
|
|
// $response->assertRedirect(route('bo.settings.edit'))
|
|
|
|
|
// ->assertSessionHas('success');
|
feat(employees): automated sync with Arcadia API, BO settings, Shopper value objects, and pagination migration
- Implement automated synchronization of employees via Arcadia API (EmployeeSyncService, SynchronizeEmployeesWithArcadiaApi, FetchAndUpsertArcadiaEmployees)
- Add Back-Office application settings for employee sites (Setting singleton, GetSettingsQuery, UpdateSettings, SettingsController, EmployeeSitesInputComponent.vue)
- Strongly type Employee attributes using Domain Value Objects (ShopperEstablishmentCode, ShopperSiteCode, ShopperServiceCode) and Eloquent Casts
- Migrate pagination from Domain to Shared\Pagination namespace across queries and inputs
- Remove legacy and dead CSV employee import/export code
- Restore Domain\Ports\Services\CsvGenerator interface for Regate order generation
- Add comprehensive Pest unit, integration, and feature test coverage
2026-10-01 17:26:30 +02:00
|
|
|
|
2026-10-29 17:05:34 +01:00
|
|
|
// $setting = Setting::getSingleton();
|
|
|
|
|
// expect($setting->employee_sites)->toBe(['PA', 'LY', 'NA']);
|
feat(employees): automated sync with Arcadia API, BO settings, Shopper value objects, and pagination migration
- Implement automated synchronization of employees via Arcadia API (EmployeeSyncService, SynchronizeEmployeesWithArcadiaApi, FetchAndUpsertArcadiaEmployees)
- Add Back-Office application settings for employee sites (Setting singleton, GetSettingsQuery, UpdateSettings, SettingsController, EmployeeSitesInputComponent.vue)
- Strongly type Employee attributes using Domain Value Objects (ShopperEstablishmentCode, ShopperSiteCode, ShopperServiceCode) and Eloquent Casts
- Migrate pagination from Domain to Shared\Pagination namespace across queries and inputs
- Remove legacy and dead CSV employee import/export code
- Restore Domain\Ports\Services\CsvGenerator interface for Regate order generation
- Add comprehensive Pest unit, integration, and feature test coverage
2026-10-01 17:26:30 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('updates employee sites with comma string input and redirects', function (): void {
|
|
|
|
|
/** @var \Tests\TestCase $this */
|
|
|
|
|
// GIVEN
|
|
|
|
|
$user = User::factory()->createOne();
|
|
|
|
|
$route = route('bo.settings.update');
|
|
|
|
|
$formData = [
|
|
|
|
|
'employee_sites' => 'PA, LY, NA',
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
// WHEN
|
|
|
|
|
$response = $this->actingAs($user, 'backend')->put($route, $formData);
|
|
|
|
|
|
|
|
|
|
// THEN
|
2026-10-29 17:05:34 +01:00
|
|
|
$response->assertForbidden();
|
|
|
|
|
// $response->assertRedirect(route('bo.settings.edit'))
|
|
|
|
|
// ->assertSessionHas('success');
|
feat(employees): automated sync with Arcadia API, BO settings, Shopper value objects, and pagination migration
- Implement automated synchronization of employees via Arcadia API (EmployeeSyncService, SynchronizeEmployeesWithArcadiaApi, FetchAndUpsertArcadiaEmployees)
- Add Back-Office application settings for employee sites (Setting singleton, GetSettingsQuery, UpdateSettings, SettingsController, EmployeeSitesInputComponent.vue)
- Strongly type Employee attributes using Domain Value Objects (ShopperEstablishmentCode, ShopperSiteCode, ShopperServiceCode) and Eloquent Casts
- Migrate pagination from Domain to Shared\Pagination namespace across queries and inputs
- Remove legacy and dead CSV employee import/export code
- Restore Domain\Ports\Services\CsvGenerator interface for Regate order generation
- Add comprehensive Pest unit, integration, and feature test coverage
2026-10-01 17:26:30 +02:00
|
|
|
|
2026-10-29 17:05:34 +01:00
|
|
|
// $setting = Setting::getSingleton();
|
|
|
|
|
// expect($setting->employee_sites)->toBe(['PA', 'LY', 'NA']);
|
feat(employees): automated sync with Arcadia API, BO settings, Shopper value objects, and pagination migration
- Implement automated synchronization of employees via Arcadia API (EmployeeSyncService, SynchronizeEmployeesWithArcadiaApi, FetchAndUpsertArcadiaEmployees)
- Add Back-Office application settings for employee sites (Setting singleton, GetSettingsQuery, UpdateSettings, SettingsController, EmployeeSitesInputComponent.vue)
- Strongly type Employee attributes using Domain Value Objects (ShopperEstablishmentCode, ShopperSiteCode, ShopperServiceCode) and Eloquent Casts
- Migrate pagination from Domain to Shared\Pagination namespace across queries and inputs
- Remove legacy and dead CSV employee import/export code
- Restore Domain\Ports\Services\CsvGenerator interface for Regate order generation
- Add comprehensive Pest unit, integration, and feature test coverage
2026-10-01 17:26:30 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('rejects invalid site code formats', function (): void {
|
|
|
|
|
/** @var \Tests\TestCase $this */
|
|
|
|
|
// GIVEN
|
|
|
|
|
$user = User::factory()->createOne();
|
|
|
|
|
$route = route('bo.settings.update');
|
|
|
|
|
$formData = [
|
|
|
|
|
'employee_sites' => ['PA', '123', 'INVALID!'],
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
// WHEN
|
|
|
|
|
$response = $this->actingAs($user, 'backend')->put($route, $formData);
|
|
|
|
|
|
|
|
|
|
// THEN
|
|
|
|
|
$response->assertSessionHasErrors(['employee_sites.1', 'employee_sites.2']);
|
|
|
|
|
});
|
|
|
|
|
});
|