feat: report the source export timestamp on every travel export page

This commit is contained in:
fromme committed 2026-09-30 12:19:04 +02:00
1 parent c2c55bc8b2
commit 272c811f4f
6 files changed
+49 -5

No files matched your search

+17 -2
View File
@@ -156,6 +156,18 @@ class TravelExportBuilderTest extends TestCase
/**
* @return array<string, mixed>
*/
public function testCarriesTheSourceExportTimestamp(): void
{
$export = $this->build(null, ['Ziel_1.xml'], "22.09.2026 11:10:15\r\nLetzte \xDCbertragung\r\nAnzahl \xDCbertragene Dateien: 177\r\nVollexport\r\n");
self::assertSame('2026-09-22T11:10:15+02:00', $export->sourceGeneratedAt?->format('c'));
}
public function testTheSourceExportTimestampIsNullWithoutAMarker(): void
{
self::assertNull($this->build()->sourceGeneratedAt);
}
private function rowFor(string $key): array
{
foreach ($this->build()->rows as $row) {
@@ -170,7 +182,7 @@ class TravelExportBuilderTest extends TestCase
/**
* @param list<string> $files
*/
private function build(?string $xml = null, array $files = ['Ziel_1.xml']): TravelExport
private function build(?string $xml = null, array $files = ['Ziel_1.xml'], ?string $marker = null): TravelExport
{
$contents = [
'Ziel_1.xml' => $xml ?? (string) file_get_contents(__DIR__.'/../Resources/travel_export_data.xml'),
@@ -183,7 +195,10 @@ class TravelExportBuilderTest extends TestCase
$files,
)));
$filesystem->method('read')->willReturnCallback(
static fn (string $path): string => $contents[$path] ?? ''
static fn (string $path): string => 'uebertragung.info' === $path ? (string) $marker : $contents[$path] ?? ''
);
$filesystem->method('fileExists')->willReturnCallback(
static fn (string $path): bool => 'uebertragung.info' === $path && null !== $marker
);
$hotelLoader = $this->createStub(HotelLoader::class);