feat: update filename formatting of booking confirmation pdf

This commit is contained in:
2026-09-09 08:39:10 +02:00
parent f8ff4b82a3
commit 1d3263373e
2 changed files with 13 additions and 18 deletions
@@ -27,26 +27,26 @@ class AccommodationBookingPdfGeneratorTest extends TestCase
self::assertSame(1, $this->pageCount($pdf));
}
public function testTheDownloadIsAnAttachmentNamedAfterTheGroup(): void
public function testTheDownloadIsAnAttachmentNamedAfterArrivalDateAndHotel(): void
{
$response = $this->createGenerator($this->breakdown())->createDownloadResponse($this->booking());
self::assertSame('application/pdf', $response->headers->get('Content-Type'));
self::assertStringContainsString('attachment;', (string) $response->headers->get('Content-Disposition'));
self::assertStringContainsString('buchung-2026-07-06-schulklasse-7b.pdf', (string) $response->headers->get('Content-Disposition'));
self::assertStringContainsString('2026-07-06 BERGBLICK Buchung.pdf', (string) $response->headers->get('Content-Disposition'));
}
public function testADocumentForAnUnacceptedOfferIsNamedAsOne(): void
public function testADocumentForAnUnacceptedOfferKeepsTheSameFilename(): void
{
// The document describes whatever the record is at the time it is produced, so it
// must not call an offer nobody has accepted a booking.
// '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.
$booking = $this->booking();
$booking->setAcceptedAt(null);
$booking->setConfirmedAt(null);
$response = $this->createGenerator($this->breakdown())->createDownloadResponse($booking);
self::assertStringContainsString('angebot-2026-07-06-schulklasse-7b.pdf', (string) $response->headers->get('Content-Disposition'));
self::assertStringContainsString('2026-07-06 BERGBLICK Buchung.pdf', (string) $response->headers->get('Content-Disposition'));
}
public function testABookingWithoutPricesCannotBeRendered(): void
@@ -74,6 +74,7 @@ class AccommodationBookingPdfGeneratorTest extends TestCase
{
$accommodation = new Accommodation();
$accommodation->setName('Haus Bergblick');
$accommodation->setCalendarCode('BERGBLICK');
$accommodation->setMaxAdolescentAge(11);
$accommodation->setCurrency('EUR');