feat: improved mutability checks for personal data in edit or create mode
This commit is contained in:
@@ -253,11 +253,24 @@ class ParticipantEditDtoTest extends TestCase
|
||||
|
||||
$bookingDto = new BookingDto($travel, 1); // hotelId must be int
|
||||
|
||||
// Create mock booking to simulate edit mode
|
||||
$mockBooking = new \App\BusProNet\Model\Booking();
|
||||
$bookingDto->booking = $mockBooking;
|
||||
|
||||
// Create valid participants with all required fields for strict validation
|
||||
$participant1 = $this->createAdultParticipant('[email protected]');
|
||||
$participant1->index = 0;
|
||||
$participant1->mutable = false; // Immutable - strict validation applies
|
||||
$participant1->mobile = '+49 123 456789'; // Required for applicant
|
||||
$participant1->address = new \App\BusProNet\Model\Address();
|
||||
$participant1->address->street = 'Test Street 1';
|
||||
$participant1->address->postCode = '12345';
|
||||
$participant1->address->city = 'Test City';
|
||||
$participant1->address->country = 'DE';
|
||||
|
||||
$participant2 = $this->createAdultParticipant('[email protected]');
|
||||
$participant2->index = 1;
|
||||
$participant2->mutable = false;
|
||||
|
||||
$bookingDto->participants = [$participant1, $participant2];
|
||||
|
||||
@@ -268,7 +281,7 @@ class ParticipantEditDtoTest extends TestCase
|
||||
|
||||
$violations = $this->validator->validate($wrapper, null, ['booking_edit']);
|
||||
|
||||
// Should have uniqueness violation in edit mode as well
|
||||
// Should have uniqueness violation (edit mode with immutable applicant = strict validation)
|
||||
$this->assertCount(1, $violations);
|
||||
}
|
||||
|
||||
@@ -357,6 +370,7 @@ class ParticipantEditDtoTest extends TestCase
|
||||
$participant->skiPass = $this->createMockService();
|
||||
$participant->transportationOutbound = $this->createMockService();
|
||||
$participant->transportationInbound = $this->createMockService();
|
||||
$participant->insurance = $this->createMockInsurance();
|
||||
|
||||
return $participant;
|
||||
}
|
||||
@@ -379,6 +393,7 @@ class ParticipantEditDtoTest extends TestCase
|
||||
$participant->skiPass = $this->createMockService();
|
||||
$participant->transportationOutbound = $this->createMockService();
|
||||
$participant->transportationInbound = $this->createMockService();
|
||||
$participant->insurance = $this->createMockInsurance();
|
||||
|
||||
return $participant;
|
||||
}
|
||||
@@ -404,4 +419,14 @@ class ParticipantEditDtoTest extends TestCase
|
||||
|
||||
return $service;
|
||||
}
|
||||
|
||||
private function createMockInsurance(): \App\BusProNet\Model\Insurance
|
||||
{
|
||||
$insurance = new \App\BusProNet\Model\Insurance();
|
||||
$insurance->id = '1';
|
||||
$insurance->label = 'Test Insurance';
|
||||
$insurance->price = 10.0;
|
||||
|
||||
return $insurance;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user