2026-06-14 21:32:07 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace Tests\Unit\Domain\Services;
|
|
|
|
|
|
2026-11-16 15:49:48 +01:00
|
|
|
use Carbon\Carbon;
|
2026-06-14 21:32:07 +02:00
|
|
|
use Carbon\CarbonImmutable;
|
|
|
|
|
use Domain\Models\Entities\Shop;
|
|
|
|
|
use Domain\Models\Entities\Shopper;
|
|
|
|
|
use Domain\Models\ValueObjects\Email;
|
|
|
|
|
use Domain\Models\ValueObjects\Entities\ShopId;
|
|
|
|
|
use Domain\Models\ValueObjects\Entities\ShopperId;
|
|
|
|
|
use Domain\Models\ValueObjects\Matricule;
|
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
|
|
|
use Domain\Models\ValueObjects\ShopperEstablishmentCode;
|
|
|
|
|
use Domain\Models\ValueObjects\ShopperServiceCode;
|
|
|
|
|
use Domain\Models\ValueObjects\ShopperSiteCode;
|
2026-06-14 21:32:07 +02:00
|
|
|
use Domain\Ports\Repositories\ShopperRepository;
|
|
|
|
|
use Domain\Ports\Repositories\ShopRepository;
|
|
|
|
|
use Domain\Services\ShopperService;
|
|
|
|
|
use Mockery;
|
2026-11-17 12:15:39 +01:00
|
|
|
use Shared\Helpers\UuidHelper;
|
2026-06-14 21:32:07 +02:00
|
|
|
|
2026-11-16 15:49:48 +01:00
|
|
|
beforeEach(function (): void {
|
|
|
|
|
$now = CarbonImmutable::parse('2026-06-15 10:00:00', 'Europe/Paris');
|
|
|
|
|
CarbonImmutable::setTestNow($now);
|
|
|
|
|
Carbon::setTestNow($now);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
afterEach(function (): void {
|
|
|
|
|
CarbonImmutable::setTestNow();
|
|
|
|
|
Carbon::setTestNow();
|
|
|
|
|
});
|
|
|
|
|
|
2026-06-14 21:32:07 +02:00
|
|
|
describe('ShopperService', function (): void {
|
|
|
|
|
|
|
|
|
|
it('gets shopper for id', function (): void {
|
|
|
|
|
// GIVEN
|
|
|
|
|
$shopRepo = Mockery::mock(ShopRepository::class);
|
|
|
|
|
$shopperRepo = Mockery::mock(ShopperRepository::class);
|
|
|
|
|
$service = new ShopperService($shopRepo, $shopperRepo);
|
|
|
|
|
|
2026-11-17 12:15:39 +01:00
|
|
|
$id = new ShopperId(UuidHelper::v7());
|
2026-06-14 21:32:07 +02:00
|
|
|
$shopper = new Shopper(
|
|
|
|
|
$id,
|
|
|
|
|
new Email('test@test.com'),
|
|
|
|
|
new Matricule('1234567'),
|
|
|
|
|
'Nom',
|
|
|
|
|
'Prenom',
|
|
|
|
|
CarbonImmutable::now()->subDay(),
|
|
|
|
|
null,
|
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
|
|
|
new ShopperEstablishmentCode('ETAB01'),
|
|
|
|
|
new ShopperSiteCode('SITEA'),
|
|
|
|
|
new ShopperServiceCode('101')
|
2026-06-14 21:32:07 +02:00
|
|
|
);
|
|
|
|
|
$shopperRepo->shouldReceive('find')->once()->with($id)->andReturn($shopper);
|
|
|
|
|
|
|
|
|
|
// WHEN
|
|
|
|
|
$result = $service->getShopperFor($id);
|
|
|
|
|
|
|
|
|
|
// THEN
|
|
|
|
|
expect($result)->toBe($shopper);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('resolves shop for employee based on exception shop', function (): void {
|
|
|
|
|
// GIVEN
|
|
|
|
|
$shopRepo = Mockery::mock(ShopRepository::class);
|
|
|
|
|
$shopperRepo = Mockery::mock(ShopperRepository::class);
|
|
|
|
|
$service = new ShopperService($shopRepo, $shopperRepo);
|
|
|
|
|
|
|
|
|
|
$shopper = new Shopper(
|
2026-11-17 12:15:39 +01:00
|
|
|
new ShopperId(UuidHelper::v7()),
|
2026-06-14 21:32:07 +02:00
|
|
|
new Email('test@test.com'),
|
|
|
|
|
new Matricule('1234567'),
|
|
|
|
|
'Nom',
|
|
|
|
|
'Prenom',
|
|
|
|
|
CarbonImmutable::now()->subDay(),
|
|
|
|
|
null,
|
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
|
|
|
new ShopperEstablishmentCode('ETAB01'),
|
|
|
|
|
new ShopperSiteCode('SITEA'),
|
|
|
|
|
new ShopperServiceCode('101')
|
2026-06-14 21:32:07 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$shop = new Shop(
|
2026-11-17 12:15:39 +01:00
|
|
|
new ShopId(UuidHelper::v7()),
|
2026-06-14 21:32:07 +02:00
|
|
|
'Shop',
|
|
|
|
|
'Addr',
|
|
|
|
|
'00000',
|
|
|
|
|
'City'
|
|
|
|
|
);
|
|
|
|
|
$shopRepo->shouldReceive('findExceptionShopFor')->once()->with($shopper->matricule)->andReturn($shop);
|
|
|
|
|
|
|
|
|
|
// WHEN
|
|
|
|
|
$result = $service->resolveShopForEmployee($shopper);
|
|
|
|
|
|
|
|
|
|
// THEN
|
|
|
|
|
expect($result)->toBe($shop);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('resolves shop for employee based on site and service', function (): void {
|
|
|
|
|
// GIVEN
|
|
|
|
|
$shopRepo = Mockery::mock(ShopRepository::class);
|
|
|
|
|
$shopperRepo = Mockery::mock(ShopperRepository::class);
|
|
|
|
|
$service = new ShopperService($shopRepo, $shopperRepo);
|
|
|
|
|
|
|
|
|
|
$shopper = new Shopper(
|
2026-11-17 12:15:39 +01:00
|
|
|
new ShopperId(UuidHelper::v7()),
|
2026-06-14 21:32:07 +02:00
|
|
|
new Email('test@test.com'),
|
|
|
|
|
new Matricule('1234567'),
|
|
|
|
|
'Nom',
|
|
|
|
|
'Prenom',
|
|
|
|
|
CarbonImmutable::now()->subDay(),
|
|
|
|
|
null,
|
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
|
|
|
new ShopperEstablishmentCode('ETAB01'),
|
|
|
|
|
new ShopperSiteCode('SITEA'),
|
|
|
|
|
new ShopperServiceCode('101')
|
2026-06-14 21:32:07 +02:00
|
|
|
);
|
|
|
|
|
|
2026-11-17 12:15:39 +01:00
|
|
|
$shop = new Shop(new ShopId(UuidHelper::v7()), 'Shop', 'Addr', '00000', 'City');
|
2026-06-14 21:32:07 +02:00
|
|
|
$shopRepo->shouldReceive('findExceptionShopFor')->once()->with($shopper->matricule)->andReturn(null);
|
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
|
|
|
$shopRepo->shouldReceive('findShopForSiteAndService')->once()->with($shopper->site, $shopper->service)->andReturn($shop);
|
2026-06-14 21:32:07 +02:00
|
|
|
|
|
|
|
|
// WHEN
|
|
|
|
|
$result = $service->resolveShopForEmployee($shopper);
|
|
|
|
|
|
|
|
|
|
// THEN
|
|
|
|
|
expect($result)->toBe($shop);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('resolves shop for employee based on site only', function (): void {
|
|
|
|
|
// GIVEN
|
|
|
|
|
$shopRepo = Mockery::mock(ShopRepository::class);
|
|
|
|
|
$shopperRepo = Mockery::mock(ShopperRepository::class);
|
|
|
|
|
$service = new ShopperService($shopRepo, $shopperRepo);
|
|
|
|
|
|
|
|
|
|
$shopper = new Shopper(
|
2026-11-17 12:15:39 +01:00
|
|
|
new ShopperId(UuidHelper::v7()),
|
2026-06-14 21:32:07 +02:00
|
|
|
new Email('test@test.com'),
|
|
|
|
|
new Matricule('1234567'),
|
|
|
|
|
'Nom',
|
|
|
|
|
'Prenom',
|
|
|
|
|
CarbonImmutable::now()->subDay(),
|
|
|
|
|
null,
|
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
|
|
|
new ShopperEstablishmentCode('ETAB01'),
|
|
|
|
|
new ShopperSiteCode('SITEA'),
|
|
|
|
|
new ShopperServiceCode('101')
|
2026-06-14 21:32:07 +02:00
|
|
|
);
|
|
|
|
|
|
2026-11-17 12:15:39 +01:00
|
|
|
$shop = new Shop(new ShopId(UuidHelper::v7()), 'Shop', 'Addr', '00000', 'City');
|
2026-06-14 21:32:07 +02:00
|
|
|
$shopRepo->shouldReceive('findExceptionShopFor')->once()->with($shopper->matricule)->andReturn(null);
|
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
|
|
|
$shopRepo->shouldReceive('findShopForSiteAndService')->once()->with($shopper->site, $shopper->service)->andReturn(null);
|
|
|
|
|
$shopRepo->shouldReceive('findShopForSiteAndService')->once()->with($shopper->site, null)->andReturn($shop);
|
2026-06-14 21:32:07 +02:00
|
|
|
|
|
|
|
|
// WHEN
|
|
|
|
|
$result = $service->resolveShopForEmployee($shopper);
|
|
|
|
|
|
|
|
|
|
// THEN
|
|
|
|
|
expect($result)->toBe($shop);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('resolves shop for employee using default fallback', function (): void {
|
|
|
|
|
// GIVEN
|
|
|
|
|
$shopRepo = Mockery::mock(ShopRepository::class);
|
|
|
|
|
$shopperRepo = Mockery::mock(ShopperRepository::class);
|
|
|
|
|
$service = new ShopperService($shopRepo, $shopperRepo);
|
|
|
|
|
|
|
|
|
|
$shopper = new Shopper(
|
2026-11-17 12:15:39 +01:00
|
|
|
new ShopperId(UuidHelper::v7()),
|
2026-06-14 21:32:07 +02:00
|
|
|
new Email('test@test.com'),
|
|
|
|
|
new Matricule('1234567'),
|
|
|
|
|
'Nom',
|
|
|
|
|
'Prenom',
|
|
|
|
|
CarbonImmutable::now()->subDay(),
|
|
|
|
|
null,
|
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
|
|
|
new ShopperEstablishmentCode('ETAB01'),
|
|
|
|
|
new ShopperSiteCode('SITEA'),
|
|
|
|
|
new ShopperServiceCode('101')
|
2026-06-14 21:32:07 +02:00
|
|
|
);
|
|
|
|
|
|
2026-11-17 12:15:39 +01:00
|
|
|
$shop = new Shop(new ShopId(UuidHelper::v7()), 'Shop', 'Addr', '00000', 'City');
|
2026-06-14 21:32:07 +02:00
|
|
|
$shopRepo->shouldReceive('findExceptionShopFor')->once()->with($shopper->matricule)->andReturn(null);
|
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
|
|
|
$shopRepo->shouldReceive('findShopForSiteAndService')->once()->with($shopper->site, $shopper->service)->andReturn(null);
|
|
|
|
|
$shopRepo->shouldReceive('findShopForSiteAndService')->once()->with($shopper->site, null)->andReturn(null);
|
2026-06-14 21:32:07 +02:00
|
|
|
$shopRepo->shouldReceive('getDefaultShop')->once()->andReturn($shop);
|
|
|
|
|
|
|
|
|
|
// WHEN
|
|
|
|
|
$result = $service->resolveShopForEmployee($shopper);
|
|
|
|
|
|
|
|
|
|
// THEN
|
|
|
|
|
expect($result)->toBe($shop);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('returns null when shopper is not found for id', function (): void {
|
|
|
|
|
// GIVEN
|
|
|
|
|
$shopRepo = Mockery::mock(ShopRepository::class);
|
|
|
|
|
$shopperRepo = Mockery::mock(ShopperRepository::class);
|
|
|
|
|
$service = new ShopperService($shopRepo, $shopperRepo);
|
|
|
|
|
|
2026-11-17 12:15:39 +01:00
|
|
|
$id = new ShopperId(UuidHelper::v7());
|
2026-06-14 21:32:07 +02:00
|
|
|
$shopperRepo->shouldReceive('find')->once()->with($id)->andReturn(null);
|
|
|
|
|
|
|
|
|
|
// WHEN
|
|
|
|
|
$result = $service->getShopFor($id);
|
|
|
|
|
|
|
|
|
|
// THEN
|
|
|
|
|
expect($result)->toBeNull();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('gets shop when shopper is found for id', function (): void {
|
|
|
|
|
// GIVEN
|
|
|
|
|
$shopRepo = Mockery::mock(ShopRepository::class);
|
|
|
|
|
$shopperRepo = Mockery::mock(ShopperRepository::class);
|
|
|
|
|
$service = new ShopperService($shopRepo, $shopperRepo);
|
|
|
|
|
|
2026-11-17 12:15:39 +01:00
|
|
|
$id = new ShopperId(UuidHelper::v7());
|
2026-06-14 21:32:07 +02:00
|
|
|
$shopper = new Shopper(
|
|
|
|
|
$id,
|
|
|
|
|
new Email('test@test.com'),
|
|
|
|
|
new Matricule('1234567'),
|
|
|
|
|
'Nom',
|
|
|
|
|
'Prenom',
|
|
|
|
|
CarbonImmutable::now()->subDay(),
|
|
|
|
|
null,
|
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
|
|
|
new ShopperEstablishmentCode('ETAB01'),
|
|
|
|
|
new ShopperSiteCode('SITEA'),
|
|
|
|
|
new ShopperServiceCode('101')
|
2026-06-14 21:32:07 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$shop = new Shop(
|
2026-11-17 12:15:39 +01:00
|
|
|
new ShopId(UuidHelper::v7()),
|
2026-06-14 21:32:07 +02:00
|
|
|
'Shop',
|
|
|
|
|
'Addr',
|
|
|
|
|
'00000',
|
|
|
|
|
'City'
|
|
|
|
|
);
|
|
|
|
|
$shopperRepo->shouldReceive('find')->once()->with($id)->andReturn($shopper);
|
|
|
|
|
$shopRepo->shouldReceive('findExceptionShopFor')->once()->with($shopper->matricule)->andReturn($shop);
|
|
|
|
|
|
|
|
|
|
// WHEN
|
|
|
|
|
$result = $service->getShopFor($id);
|
|
|
|
|
|
|
|
|
|
// THEN
|
|
|
|
|
expect($result)->toBe($shop);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('returns false when customer not found checking app pass orders', function (): void {
|
|
|
|
|
// GIVEN
|
|
|
|
|
$shopRepo = Mockery::mock(ShopRepository::class);
|
|
|
|
|
$shopperRepo = Mockery::mock(ShopperRepository::class);
|
|
|
|
|
$service = new ShopperService($shopRepo, $shopperRepo);
|
|
|
|
|
|
2026-11-17 12:15:39 +01:00
|
|
|
$id = new ShopperId(UuidHelper::v7());
|
2026-06-14 21:32:07 +02:00
|
|
|
$shopperRepo->shouldReceive('find')->once()->with($id)->andReturn(null);
|
|
|
|
|
|
|
|
|
|
// WHEN
|
|
|
|
|
$result = $service->canCustomerPassOrdersApp($id);
|
|
|
|
|
|
|
|
|
|
// THEN
|
|
|
|
|
expect($result)->toBeFalse();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('returns customer active status for pass orders app', function (): void {
|
|
|
|
|
// GIVEN
|
|
|
|
|
$shopRepo = Mockery::mock(ShopRepository::class);
|
|
|
|
|
$shopperRepo = Mockery::mock(ShopperRepository::class);
|
|
|
|
|
$service = new ShopperService($shopRepo, $shopperRepo);
|
|
|
|
|
|
2026-11-17 12:15:39 +01:00
|
|
|
$id = new ShopperId(UuidHelper::v7());
|
2026-06-14 21:32:07 +02:00
|
|
|
$shopper = new Shopper(
|
|
|
|
|
$id,
|
|
|
|
|
new Email('test@test.com'),
|
|
|
|
|
new Matricule('1234567'),
|
|
|
|
|
'Nom',
|
|
|
|
|
'Prenom',
|
|
|
|
|
CarbonImmutable::now()->subDay(),
|
|
|
|
|
null,
|
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
|
|
|
new ShopperEstablishmentCode('ETAB01'),
|
|
|
|
|
new ShopperSiteCode('SITEA'),
|
|
|
|
|
new ShopperServiceCode('101')
|
2026-06-14 21:32:07 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$shopperRepo->shouldReceive('find')->once()->with($id)->andReturn($shopper);
|
|
|
|
|
|
|
|
|
|
// WHEN
|
|
|
|
|
$result = $service->canCustomerPassOrdersApp($id);
|
|
|
|
|
|
|
|
|
|
// THEN
|
|
|
|
|
expect($result)->toBeTrue();
|
|
|
|
|
});
|
|
|
|
|
});
|