value())->toBe(25) ->and($ofFifty->value())->toBe(50) ->and($defaultFactory->value())->toBe(25) ->and($maxBoundary->value())->toBe(10000) ->and((string) $ofFifty)->toBe('50') ->and(json_encode($ofFifty))->toBe('50'); }); it('checks equality with same, different, and non-PageSize values', function (): void { // GIVEN $size = PageSize::of(25); // WHEN / THEN expect($size->equals(PageSize::of(25)))->toBeTrue() ->and($size->equals(PageSize::of(50)))->toBeFalse() ->and($size->equals(null))->toBeFalse() ->and($size->equals(new PageNumber(25)))->toBeFalse(); }); it('rejects zero, negative, and above-max page sizes', function (int $invalidValue): void { // GIVEN / WHEN / THEN expect(static fn (): PageSize => new PageSize($invalidValue)) ->toThrow(\InvalidArgumentException::class); })->with([ 'zero' => 0, 'negative' => -1, 'above max' => 10001, ]);