feat: split booking between participants and applicant
addresses #869f2q1vu
This commit is contained in:
1 parent
2d49212b08
commit
1ff293f41f
44 files changed
+2024
-316
No files matched your search
@@ -205,46 +205,34 @@ class ParticipantDtoTest extends TestCase
|
||||
return $insurance;
|
||||
}
|
||||
|
||||
public function testRequiresOwnEmailIsFalseForNonApplicantChild(): void
|
||||
public function testIsChildIsTrueBelowTheAgeThreshold(): void
|
||||
{
|
||||
$participant = new ParticipantDto();
|
||||
$participant->index = 1;
|
||||
$participant->dateOfBirth = new \DateTimeImmutable('2015-01-01');
|
||||
|
||||
$this->assertFalse($participant->requiresOwnEmail());
|
||||
$this->assertTrue($participant->isChild());
|
||||
}
|
||||
|
||||
public function testRequiresOwnEmailIsTrueForNonApplicantAdult(): void
|
||||
public function testIsChildIsFalseForAnAdult(): void
|
||||
{
|
||||
$participant = new ParticipantDto();
|
||||
$participant->index = 1;
|
||||
$participant->dateOfBirth = new \DateTimeImmutable('1990-01-01');
|
||||
|
||||
$this->assertTrue($participant->requiresOwnEmail());
|
||||
$this->assertFalse($participant->isChild());
|
||||
}
|
||||
|
||||
public function testRequiresOwnEmailIsTrueForTheApplicantEvenAsAChild(): void
|
||||
{
|
||||
$participant = new ParticipantDto();
|
||||
$participant->index = 0;
|
||||
$participant->dateOfBirth = new \DateTimeImmutable('2015-01-01');
|
||||
|
||||
$this->assertTrue(
|
||||
$participant->requiresOwnEmail(),
|
||||
'The applicant is the booking contact and always has to be reachable'
|
||||
);
|
||||
}
|
||||
|
||||
public function testRequiresOwnEmailTreatsUnknownAgeAsAdult(): void
|
||||
public function testIsChildTreatsUnknownAgeAsAdult(): void
|
||||
{
|
||||
$participant = new ParticipantDto();
|
||||
$participant->index = 1;
|
||||
$participant->dateOfBirth = null;
|
||||
|
||||
$this->assertTrue($participant->requiresOwnEmail());
|
||||
$this->assertFalse($participant->isChild(), 'An unknown date of birth counts as an adult');
|
||||
}
|
||||
|
||||
public function testRequiresOwnEmailBoundaryAtChildAgeThreshold(): void
|
||||
public function testIsChildBoundaryAtAgeThreshold(): void
|
||||
{
|
||||
$exactlyThreshold = new ParticipantDto();
|
||||
$exactlyThreshold->index = 1;
|
||||
@@ -257,7 +245,7 @@ class ParticipantDtoTest extends TestCase
|
||||
->modify(sprintf('-%d years', ParticipantDto::CHILD_AGE_THRESHOLD))
|
||||
->modify('+1 day');
|
||||
|
||||
$this->assertTrue($exactlyThreshold->requiresOwnEmail());
|
||||
$this->assertFalse($oneDayShort->requiresOwnEmail());
|
||||
$this->assertFalse($exactlyThreshold->isChild());
|
||||
$this->assertTrue($oneDayShort->isChild());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user