fix: allow updating room assignments in edit mode

This commit is contained in:
Björn Fromme
2026-03-16 12:02:59 +01:00
parent 380b1ed329
commit f46cc59041
11 changed files with 191 additions and 21 deletions
@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Tests\Form\Model;
use App\BusProNet\Model\Travel;
use App\BusProNet\XmlLoader\AgencyLoader;
use App\Form\Model\BookingDto;
use App\Form\Model\ParticipantDto;
use App\Form\Model\ParticipantEditDto;
@@ -373,6 +374,46 @@ class ParticipantEditDtoTest extends TestCase
$this->assertCount(0, $violations5);
}
public function testInternalAgencyBookingSkipsEmailUniqueness(): void
{
$bookingDto = $this->createBookingDtoWithParticipants([
$this->createAdultParticipant('[email protected]'),
$this->createAdultParticipant('[email protected]'),
$this->createAdultParticipant('[email protected]'),
]);
// Mark as internal agency booking
$bookingDto->agencyCode = AgencyLoader::INTERNAL_AGENCY_CODE;
// Validate second participant (non-applicant adult with duplicate email)
$wrapper = new ParticipantEditDto(
participant: $bookingDto->participants[1],
bookingContext: $bookingDto,
);
$violations = $this->validator->validate($wrapper, null, ['booking_create']);
$this->assertCount(0, $violations, 'Internal agency bookings should skip email uniqueness validation');
}
public function testNonAgencyBookingStillEnforcesEmailUniqueness(): void
{
$bookingDto = $this->createBookingDtoWithParticipants([
$this->createAdultParticipant('[email protected]'),
$this->createAdultParticipant('[email protected]'),
]);
// Non-agency booking (default agencyCode is null)
$wrapper = new ParticipantEditDto(
participant: $bookingDto->participants[1],
bookingContext: $bookingDto,
);
$violations = $this->validator->validate($wrapper, null, ['booking_create']);
$this->assertCount(1, $violations, 'Non-agency bookings should still enforce email uniqueness');
}
// =========================================
// Ski Pass Validation Tests (Baby Age Exemption)
// =========================================