newInstanceWithoutConstructor(); $method = new ReflectionMethod(DownloadPdfAdminPage::class, 'safeDownloadBaseName'); $method->setAccessible(true); $cases = [ 'Renewals (pending accounts and contacts)' => 'Renewals_pending_accounts_and_contacts', 'Invoice run: May/June 2026' => 'Invoice_run_May_June_2026', ' ... ' => 'mailshot', 'Quotes " and spaces' => 'Quotes_and_spaces', ]; foreach ($cases as $input => $expected) { $actual = $method->invoke($page, $input); if ($actual !== $expected) { fwrite(STDERR, sprintf("Expected %s => %s, got %s\n", $input, $expected, (string) $actual)); exit(1); } } echo "Download PDF filename regression test passed\n";