feat: body dimensions mandatory with selected rentals, updated help text

feat: body dimensions mandatory with selected rentals
This commit is contained in:
Björn Fromme
2026-03-16 12:02:28 +01:00
parent 957e20d763
commit 667324df69
4 changed files with 100 additions and 10 deletions
@@ -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();
}