fix: applicant split in edit mode, drop create-mode agency checks

This commit is contained in:
fromme committed 2026-10-16 17:49:04 +02:00
1 parent ad6e42ab0c
commit 38f0f23ea3
12 files changed
+167 -68

No files matched your search

+33 -1
View File
@@ -8,6 +8,7 @@ use App\BusProNet\Constants;
use App\BusProNet\Model\Address;
use App\BusProNet\Model\Booking;
use App\BusProNet\Model\Insurance;
use App\BusProNet\Model\PersonalData;
use App\BusProNet\Model\Service;
use App\BusProNet\Model\Travel;
use App\BusProNet\XmlLoader\AgencyLoader;
@@ -703,7 +704,6 @@ class ParticipantEditDtoTest extends TestCase
$bookingDto = new BookingDto($travel, 1);
$bookingDto->booking = new Booking();
$bookingDto->agencyCode = AgencyLoader::INTERNAL_AGENCY_CODE;
$participant0 = $this->createAdultParticipant('[email protected]');
$participant0->index = 0;
@@ -740,6 +740,38 @@ class ParticipantEditDtoTest extends TestCase
$this->assertCount(0, $addressViolations1, 'Non-applicant address should not be required in edit submission');
}
public function testEditSubmissionDoesNotAskASplitBookingsFirstParticipantForAnAddress(): void
{
$travel = $this->createTravelOfferingSkiPasses();
$applicant = new PersonalData();
$applicant->personId = 100;
$bookingDto = new BookingDto($travel, 1);
$bookingDto->booking = new Booking();
$bookingDto->booking->applicant = $applicant;
$participant0 = $this->createAdultParticipant('[email protected]');
$participant0->index = 0;
$participant0->personId = 200;
$participant0->address = null;
$bookingDto->participants = [$participant0];
$wrapper0 = new ParticipantEditDto(
participant: $bookingDto->participants[0],
bookingContext: $bookingDto,
);
$violations0 = $this->validator->validate($wrapper0, null, ['booking_edit', 'strict_required']);
$addressViolations0 = array_filter(
iterator_to_array($violations0),
fn ($v) => 'address' === $v->getPropertyPath() || 'participant.address' === $v->getPropertyPath()
);
$this->assertCount(0, $addressViolations0, 'A traveller who is not the applicant owes no address');
}
public function testSkiPassAgeCalculatedAtTravelDate(): void
{
$travel = $this->createTravelOfferingSkiPasses();