timestampFor( "22.09.2026 11:10:15\r\nLetzte \xDCbertragung\r\nAnzahl \xDCbertragene Dateien: 177\r\nVollexport\r\n" )); } public function testAMissingMarkerIsNullRatherThanAServerError(): void { self::assertNull($this->timestampFor(null)); } public function testAnEmptyMarkerIsNull(): void { self::assertNull($this->timestampFor('')); } public function testAnUnparseableMarkerIsNull(): void { self::assertNull($this->timestampFor("gestern\r\nLetzte \xDCbertragung\r\nAnzahl \xDCbertragene Dateien: 177\r\n")); } private function timestampFor(?string $marker): ?string { $storage = $this->createStub(FilesystemOperator::class); $storage->method('fileExists')->willReturn(null !== $marker); $storage->method('read')->willReturn((string) $marker); $controller = new LastUpdateController($storage); $controller->setContainer(new Container()); $body = json_decode((string) $controller->index()->getContent(), true); self::assertArrayHasKey('timestamp', $body); return $body['timestamp']; } }