feat: body dimensions mandatory with selected rentals, updated help text
feat: body dimensions mandatory with selected rentals
This commit is contained in:
@@ -17,17 +17,74 @@ class ParticipantValidatorTest extends ConstraintValidatorTestCase
|
||||
return new ParticipantValidator();
|
||||
}
|
||||
|
||||
public function testParticipantWithRentalsButNoBodyMeasurementsPassesValidation(): void
|
||||
public function testParticipantWithRentalsAndBodyMeasurementsPassesValidation(): void
|
||||
{
|
||||
$participant = $this->createValidParticipant();
|
||||
$participant->rentals = [$this->createMockService()];
|
||||
$participant->height = '170';
|
||||
$participant->weight = '70';
|
||||
$participant->shoeSize = '42';
|
||||
|
||||
$this->validator->validate($participant, new Participant());
|
||||
|
||||
$this->assertNoViolation();
|
||||
}
|
||||
|
||||
public function testParticipantWithRentalsButNoHeightFailsValidation(): void
|
||||
{
|
||||
$participant = $this->createValidParticipant();
|
||||
$participant->rentals = [$this->createMockService()];
|
||||
$participant->height = null;
|
||||
$participant->weight = '70';
|
||||
$participant->shoeSize = '42';
|
||||
|
||||
$this->validator->validate($participant, new Participant());
|
||||
|
||||
$this->buildViolation('Bitte auswählen')
|
||||
->atPath('property.path.height')
|
||||
->assertRaised();
|
||||
}
|
||||
|
||||
public function testParticipantWithRentalsButNoWeightFailsValidation(): void
|
||||
{
|
||||
$participant = $this->createValidParticipant();
|
||||
$participant->rentals = [$this->createMockService()];
|
||||
$participant->height = '170';
|
||||
$participant->weight = null;
|
||||
$participant->shoeSize = '42';
|
||||
|
||||
$this->validator->validate($participant, new Participant());
|
||||
|
||||
$this->buildViolation('Bitte auswählen')
|
||||
->atPath('property.path.weight')
|
||||
->assertRaised();
|
||||
}
|
||||
|
||||
public function testParticipantWithRentalsButNoShoeSizeFailsValidation(): void
|
||||
{
|
||||
$participant = $this->createValidParticipant();
|
||||
$participant->rentals = [$this->createMockService()];
|
||||
$participant->height = '170';
|
||||
$participant->weight = '70';
|
||||
$participant->shoeSize = null;
|
||||
|
||||
$this->validator->validate($participant, new Participant());
|
||||
|
||||
$this->buildViolation('Bitte auswählen')
|
||||
->atPath('property.path.shoeSize')
|
||||
->assertRaised();
|
||||
}
|
||||
|
||||
public function testParticipantWithoutRentalsAndNoBodyMeasurementsPassesValidation(): void
|
||||
{
|
||||
$participant = $this->createValidParticipant();
|
||||
$participant->rentals = [];
|
||||
$participant->height = null;
|
||||
$participant->weight = null;
|
||||
$participant->shoeSize = null;
|
||||
|
||||
$this->validator->validate($participant, new Participant());
|
||||
|
||||
// Body measurements are optional and can be provided later
|
||||
$this->assertNoViolation();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user