test(integration): adapt repository and directory integration tests to Pagination VOs

This commit is contained in:
Jérémy Munsch 2026-09-15 12:49:01 +02:00
parent 40519c4a2b
commit d96f903e1c
Signed by: forge-joniko
GPG key ID: D7EFE2F5CB6CC0E4
4 changed files with 16 additions and 6 deletions

View file

@ -15,9 +15,11 @@ use Infra\Adapters\Directories\ArcadiaMarqueBrandDirectory;
use Infra\Cache\BrandCache;
use Infra\Database\Models\Brand as BrandModel;
use Mockery;
use Shared\Pagination;
use Tests\TestCase;
use Ramsey\Uuid\Uuid;
use Shared\Pagination;
use Shared\Pagination\PageNumber;
use Shared\Pagination\PageSize;
use Tests\TestCase;
uses(TestCase::class, RefreshDatabase::class);
covers(ArcadiaMarqueBrandDirectory::class);
@ -49,7 +51,7 @@ describe('ArcadiaMarqueBrandDirectory Integration Tests', function (): void {
'TYPE_MARQUE' => 1,
]);
$pagination = Pagination::ofPage(1, 25);
$pagination = Pagination::ofPage(new PageNumber(1), new PageSize(25));
// WHEN
$result = $directory->findAll($pagination);
@ -81,7 +83,7 @@ describe('ArcadiaMarqueBrandDirectory Integration Tests', function (): void {
->andThrow(new \RuntimeException('Oracle is down'));
$directory = new ArcadiaMarqueBrandDirectory($failingConnection, null);
$pagination = Pagination::ofPage(1, 25);
$pagination = Pagination::ofPage(new PageNumber(1), new PageSize(25));
// WHEN
$result = $directory->findAll($pagination);

View file

@ -15,6 +15,8 @@ use Infra\Adapters\Repositories\ApiClientRepository;
use Infra\Database\Models\ApiClient;
use Ramsey\Uuid\Uuid;
use Shared\Pagination;
use Shared\Pagination\PageNumber;
use Shared\Pagination\PageSize;
use Tests\TestCase;
uses(TestCase::class, RefreshDatabase::class);
@ -216,7 +218,7 @@ describe('ApiClientRepository Integration Tests', function (): void {
]);
}
$pagination = Pagination::ofPage(pageNumber: 1, pageSize: 2);
$pagination = Pagination::ofPage(pageNumber: new PageNumber(1), pageSize: new PageSize(2));
// WHEN
$paginated = $repository->findAll($pagination);

View file

@ -16,6 +16,8 @@ use Infra\Cache\BrandCache;
use Infra\Database\Models\Brand as BrandModel;
use Ramsey\Uuid\Uuid;
use Shared\Pagination;
use Shared\Pagination\PageNumber;
use Shared\Pagination\PageSize;
use Tests\TestCase;
uses(TestCase::class, RefreshDatabase::class);
@ -169,7 +171,7 @@ describe('EloquentBrandRepository Integration Tests', function (): void {
]);
// WHEN
$all = $repository->findAll(Pagination::ofPage(1, 25));
$all = $repository->findAll(Pagination::ofPage(new PageNumber(1), new PageSize(25)));
// THEN
expect($all->getItems())->toHaveCount(2)

View file

@ -13,6 +13,10 @@ covers(Brand::class);
uses(TestCase::class, RefreshDatabase::class);
beforeEach(function (): void {
Brand::query()->delete();
});
describe('Brand Eloquent Model & Factory', function (): void {
it('creates and persists a Brand record with computed created_at from UUIDv7', function (): void {
// GIVEN