From 56deb1e24b07e86bd3f6222ae314b6fc2cea2ebf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Thu, 1 Oct 2026 08:45:15 +0200 Subject: [PATCH] feat: name the accommodation booking PDF after its record label --- src/Service/AccommodationBookingPdfGenerator.php | 2 +- tests/Service/AccommodationBookingPdfGeneratorTest.php | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Service/AccommodationBookingPdfGenerator.php b/src/Service/AccommodationBookingPdfGenerator.php index 395a361d..2751aa33 100644 --- a/src/Service/AccommodationBookingPdfGenerator.php +++ b/src/Service/AccommodationBookingPdfGenerator.php @@ -93,7 +93,7 @@ class AccommodationBookingPdfGenerator $parts = array_filter([ $booking->getDateFrom()?->format('Y-m-d'), $booking->getAccommodation()?->getCalendarCode(), - 'Buchung', + $booking->recordLabel(), ]); return implode(' ', $parts).'.pdf'; diff --git a/tests/Service/AccommodationBookingPdfGeneratorTest.php b/tests/Service/AccommodationBookingPdfGeneratorTest.php index 0ca6ba4d..29022ac7 100644 --- a/tests/Service/AccommodationBookingPdfGeneratorTest.php +++ b/tests/Service/AccommodationBookingPdfGeneratorTest.php @@ -68,17 +68,16 @@ class AccommodationBookingPdfGeneratorTest extends TestCase self::assertStringContainsString('2026-07-06 BERGBLICK Buchung.pdf', (string) $response->headers->get('Content-Disposition')); } - public function testADocumentForAnUnacceptedOfferKeepsTheSameFilename(): void + public function testADocumentForAnUnacceptedOfferIsNamedAsAnOffer(): void { - // 'Buchung' in the filename is a literal, not the record label: the office files - // these documents by date and house, and a second spelling would break that order. + // The filename follows the record label, like the document's heading. $booking = $this->booking(); $booking->setAcceptedAt(null); $booking->setConfirmedAt(null); $response = $this->createGenerator($this->breakdown())->createDownloadResponse($booking); - self::assertStringContainsString('2026-07-06 BERGBLICK Buchung.pdf', (string) $response->headers->get('Content-Disposition')); + self::assertStringContainsString('2026-07-06 BERGBLICK Angebot.pdf', (string) $response->headers->get('Content-Disposition')); } public function testABookingWithoutPricesCannotBeRendered(): void