feat: additional custom discount applied to total price
This commit is contained in:
@@ -73,6 +73,42 @@ class AccommodationBookingTypeTest extends TestCase
|
||||
self::assertSame(['email', 'firstName', 'groupName', 'lastName'], $properties);
|
||||
}
|
||||
|
||||
/**
|
||||
* The label is printed verbatim on the customer's PDF, so a percentage without one is
|
||||
* refused — and in the Default group, so that even a draft cannot store the pair half-set.
|
||||
*/
|
||||
public function testTotalDiscountRequiresALabel(): void
|
||||
{
|
||||
$booking = new AccommodationBooking();
|
||||
$booking->setTotalDiscount(5);
|
||||
|
||||
$violations = $this->validate($booking, ['Default']);
|
||||
|
||||
self::assertCount(1, $violations);
|
||||
self::assertSame('totalDiscountLabel', $violations[0]->getPropertyPath());
|
||||
}
|
||||
|
||||
public function testALabelledTotalDiscountPassesValidation(): void
|
||||
{
|
||||
$booking = new AccommodationBooking();
|
||||
$booking->setTotalDiscount(5);
|
||||
$booking->setTotalDiscountLabel('Treuerabatt');
|
||||
|
||||
self::assertCount(0, $this->validate($booking, ['Default']));
|
||||
}
|
||||
|
||||
/**
|
||||
* The reverse is harmless — without a percentage the label never reaches a breakdown row —
|
||||
* so it is deliberately left valid rather than blocking a half-typed edit.
|
||||
*/
|
||||
public function testALabelWithoutAPercentageIsAccepted(): void
|
||||
{
|
||||
$booking = new AccommodationBooking();
|
||||
$booking->setTotalDiscountLabel('Treuerabatt');
|
||||
|
||||
self::assertCount(0, $this->validate($booking, ['Default']));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user