id())->toBe($id) ->and($campaignRequest->code)->toBe($code) ->and($campaignRequest->applicant)->toBe($applicant) ->and($campaignRequest->country)->toBe($country) ->and($campaignRequest->campaignType)->toBe($campaignType) ->and($campaignRequest->printRules)->toBe($printRules) ->and($campaignRequest->requestedCoupon)->toBe($requestedCoupon) ->and($campaignRequest->status)->toBe($status) ->and($campaignRequest->updatedAt)->toBeNull() ->and($campaignRequest->updatedAt())->toBeNull(); }); it('hydrates a campaign request with a null printRules', function (): void { // WHEN $campaignRequest = CampaignRequest::hydrate( CampaignRequestId::generate(), new BrandCode('AAA01'), new Applicant('John', 'Doe', new Email('john.doe@example.com')), Country::FR, CampaignType::CLUB, null, aRequestedCoupon(), CampaignStatus::CREATED, ); // THEN expect($campaignRequest->printRules)->toBeNull(); }); it('hydrates a campaign request with an explicit updatedAt date', function (): void { // GIVEN $updatedAt = new \DateTimeImmutable('2026-06-15 12:00:00', new \DateTimeZone('UTC')); // WHEN $campaignRequest = CampaignRequest::hydrate( CampaignRequestId::generate(), new BrandCode('AAA01'), new Applicant('John', 'Doe', new Email('john.doe@example.com')), Country::FR, CampaignType::CLUB, new PrintRules(maxPerCustomer: 3), aRequestedCoupon(), CampaignStatus::CREATED, $updatedAt, ); // THEN expect($campaignRequest->updatedAt)->toBe($updatedAt) ->and($campaignRequest->updatedAt())->toBe($updatedAt); }); it('returns the creation date extracted from the id', function (): void { // GIVEN $expected = new \DateTimeImmutable('2024-06-15 12:34:56.789000', new \DateTimeZone('UTC')); $id = new CampaignRequestId(Uuid::uuid7($expected)); $campaignRequest = CampaignRequest::hydrate( $id, new BrandCode('AAA01'), new Applicant('John', 'Doe', new Email('john.doe@example.com')), Country::FR, CampaignType::CLUB, new PrintRules(maxPerCustomer: 3), aRequestedCoupon(), CampaignStatus::CREATED, ); // WHEN $result = $campaignRequest->createdAt(); // THEN expect($result->format('Y-m-d H:i:s.v'))->toBe($expected->format('Y-m-d H:i:s.v')); }); });