fix: validate body dimensions when rentals are selected only
This commit is contained in:
@@ -89,6 +89,34 @@ class ParticipantValidatorTest extends ConstraintValidatorTestCase
|
||||
$this->assertNoViolation();
|
||||
}
|
||||
|
||||
public function testParticipantWithoutRentalsIgnoresOutOfRangeBodyMeasurements(): void
|
||||
{
|
||||
$participant = $this->createValidParticipant();
|
||||
$participant->rentals = [];
|
||||
$participant->height = '999';
|
||||
$participant->weight = '999';
|
||||
$participant->shoeSize = '999';
|
||||
|
||||
$this->validator->validate($participant, new Participant());
|
||||
|
||||
$this->assertNoViolation();
|
||||
}
|
||||
|
||||
public function testParticipantWithRentalsAndOutOfRangeShoeSizeFailsValidation(): void
|
||||
{
|
||||
$participant = $this->createValidParticipant();
|
||||
$participant->rentals = [$this->createMockService()];
|
||||
$participant->height = '170';
|
||||
$participant->weight = '70';
|
||||
$participant->shoeSize = '51';
|
||||
|
||||
$this->validator->validate($participant, new Participant());
|
||||
|
||||
$this->buildViolation('Bitte gib eine Zahl zwischen 35 und 50 ein. Falls du außerhalb dieses Bereichs bist, ruf gerne unser Kundenoffice an.')
|
||||
->atPath('property.path.shoeSize')
|
||||
->assertRaised();
|
||||
}
|
||||
|
||||
public function testCanceledParticipantSkipsValidation(): void
|
||||
{
|
||||
$participant = $this->createValidParticipant();
|
||||
|
||||
Reference in New Issue
Block a user