feat: replace custom discount with absolute value in favor of percentage
This commit is contained in:
@@ -74,13 +74,13 @@ class AccommodationBookingTypeTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* The label is printed verbatim on the customer's PDF, so a percentage without one is
|
||||
* The label is printed verbatim on the customer's PDF, so an amount 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);
|
||||
$booking->setTotalDiscountAmount(5000);
|
||||
|
||||
$violations = $this->validate($booking, ['Default']);
|
||||
|
||||
@@ -91,17 +91,17 @@ class AccommodationBookingTypeTest extends TestCase
|
||||
public function testALabelledTotalDiscountPassesValidation(): void
|
||||
{
|
||||
$booking = new AccommodationBooking();
|
||||
$booking->setTotalDiscount(5);
|
||||
$booking->setTotalDiscountAmount(5000);
|
||||
$booking->setTotalDiscountLabel('Treuerabatt');
|
||||
|
||||
self::assertCount(0, $this->validate($booking, ['Default']));
|
||||
}
|
||||
|
||||
/**
|
||||
* The reverse is harmless — without a percentage the label never reaches a breakdown row —
|
||||
* The reverse is harmless — without an amount the label never reaches a breakdown row —
|
||||
* so it is deliberately left valid rather than blocking a half-typed edit.
|
||||
*/
|
||||
public function testALabelWithoutAPercentageIsAccepted(): void
|
||||
public function testALabelWithoutAnAmountIsAccepted(): void
|
||||
{
|
||||
$booking = new AccommodationBooking();
|
||||
$booking->setTotalDiscountLabel('Treuerabatt');
|
||||
|
||||
Reference in New Issue
Block a user