ldc-cocotte/tests/Integration/WithApp/App/Queries/PickupExceptions/GetPaginatedPickupExceptionsQueryTest.php
Jérémy Munsch 8b96ce90be
test(casts): add tests for EmployeeSitesCast functionality
test(casts): add tests for ShopperEstablishmentCodeCast functionality

test(casts): add tests for ShopperServiceCodeCast functionality

test(casts): add tests for ShopperSiteCodeCast functionality

test(dto): update ProductDtoTest to include additional fields

test(dto): update SettingDtoTest to remove arcadiaSites assertions

test(events): update AnOrderHasBeenPlacedTest to use value objects

test(entities): update OrderTest to use value objects for employee details

test(value-objects): update EmployeeUpsertDataTest to use value objects

test(pagination): update PaginationTest to access value properties

test(services): update AppCustomerAuthServiceTest to use CrmHashcode

test(services): update CrmServiceTest to use CrmHashcode for customer retrieval
2026-10-27 09:58:45 +01:00

38 lines
1.4 KiB
PHP

<?php
declare(strict_types=1);
use App\Dto\PickupExceptionDto;
use App\Models\PickupException;
use App\Queries\PickupExceptions\GetPaginatedPickupExceptionsQuery;
use App\Queries\PickupExceptions\GetPaginatedPickupExceptionsQueryInput;
use App\Services\DataTableService;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Shared\Pagination\PageNumber;
use Shared\Pagination\PageSize;
use Shared\Pagination\Pagination;
uses(RefreshDatabase::class);
describe('GetPaginatedPickupExceptionsQuery', function () {
test('it executes and returns paginated pickup exception DTOs', function () {
// GIVEN
PickupException::factory()->count(3)->create();
$dataTableService = resolve(DataTableService::class);
$query = new GetPaginatedPickupExceptionsQuery($dataTableService);
$input = new GetPaginatedPickupExceptionsQueryInput(
pagination: Pagination::ofPage(new PageNumber(1), new PageSize(10)),
);
// WHEN
$paginator = $query($input);
// THEN
expect($paginator)->toBeInstanceOf(LengthAwarePaginator::class)
->and($paginator->total())->toBe(3)
->and($paginator->items())->toHaveCount(3)
->and($paginator->items()[0])->toBeInstanceOf(PickupExceptionDto::class);
});
});