. * */ namespace Ampache\Config; use PHPUnit\Framework\TestCase; class DisplayNotificationTest extends TestCase { public function testAccentsSurviveUnescaped(): void { $this->assertStringContainsString('mises à jour', $this->emit('mises à jour')); } public function testNothingCanCloseTheScriptBlockOrTheStringLiteral(): void { $html = $this->emit(' "quoted" \'apostrophe\''); $this->assertStringNotContainsString(''), 'the payload must not close the block early'); } public function testTheMessageIsNotWrappedInQuotesTwice(): void { $this->assertStringContainsString('displayNotification("Saved.", 5000);', $this->emit('Saved.')); } private function emit(string $message): string { ob_start(); display_notification($message); return (string) ob_get_clean(); } }