feat: name the accommodation booking PDF after its record label

This commit is contained in:
fromme committed 2026-10-01 08:46:12 +02:00
1 parent ec10ca3623
commit 56deb1e24b
2 files changed
+4 -5

No files matched your search

@@ -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';
@@ -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