array('', '<script>alert(1)</script>'), 'double quotes' => array('say "hi"', 'say "hi"'), 'single quotes' => array("it's", 'it's'), 'ampersand' => array('fish & chips', 'fish & chips'), 'plain text' => array('Plain text', 'Plain text'), 'utf-8' => array('café – “quoted”', 'café – “quoted”'), ); } #[DataProvider('escapes')] public function testHEscapesText(string $input, string $expected): void { $this->assertSame($expected, h($input)); } #[DataProvider('escapes')] public function testFormValueEscapesText(string $input, string $expected): void { $this->assertSame($expected, form_value($input)); } public function testHKeepsExistingEntities(): void { $this->assertSame('Wait… & see', h('Wait… & see')); } public function testFormValueEscapesExistingEntitiesSoThatTheyComeBackUnchanged(): void { $this->assertSame('Wait&hellip;', form_value('Wait…')); $this->assertSame('Wait…', html_entity_decode(form_value('Wait…'), ENT_QUOTES, 'UTF-8')); } public function testFormValueStopsATextareaFromEnding(): void { $this->assertSame('</textarea><script>', form_value('