ldc-cocotte/tests/Integration/WithApp/App/Queries/Slides/GetPaginatedSlidesQueryTest.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

43 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
use App\Dto\SlideDto;
use App\Models\Slide;
use App\Queries\Slides\GetPaginatedSlidesQuery;
use App\Queries\Slides\GetPaginatedSlidesQueryInput;
use Shared\Pagination\PageNumber;
use Shared\Pagination\PageSize;
use Shared\Pagination\Pagination;
describe('GetPaginatedSlidesQuery', function (): void {
it('returns a paginator of SlideDto instances', function (): void {
// GIVEN
$slide1 = new Slide();
$slide1->title = 'Premier Slide';
$slide1->text = 'Texte premier slide';
$slide1->order = 1;
$slide1->save();
$slide2 = new Slide();
$slide2->title = 'Deuxième Slide';
$slide2->text = 'Texte deuxième slide';
$slide2->order = 2;
$slide2->save();
/** @var GetPaginatedSlidesQuery $query */
$query = app(GetPaginatedSlidesQuery::class);
$input = new GetPaginatedSlidesQueryInput(
pagination: Pagination::ofPage(new PageNumber(1), new PageSize(10)),
);
// WHEN
$paginator = $query($input);
// THEN
expect($paginator->total())->toBe(2)
->and($paginator->items())->toHaveCount(2)
->and($paginator->items()[0])->toBeInstanceOf(SlideDto::class)
->and($paginator->items()[1])->toBeInstanceOf(SlideDto::class);
});
});