allowElement('p') ->allowElement('br') ->allowElement('strong') ->allowElement('em') ->allowElement('ul') ->allowElement('ol') ->allowElement('li') ->allowElement('a', ['href', 'target', 'rel']); $this->sanitizer = new HomeworkHtmlSanitizer(new HtmlSanitizer($config)); } #[Test] public function itAllowsBoldText(): void { $html = '

Texte en gras

'; self::assertSame($html, $this->sanitizer->sanitize($html)); } #[Test] public function itAllowsItalicText(): void { $html = '

Texte en italique

'; self::assertSame($html, $this->sanitizer->sanitize($html)); } #[Test] public function itAllowsUnorderedLists(): void { $html = ''; self::assertSame($html, $this->sanitizer->sanitize($html)); } #[Test] public function itAllowsOrderedLists(): void { $html = '
  1. Premier
  2. Deuxième
'; self::assertSame($html, $this->sanitizer->sanitize($html)); } #[Test] public function itAllowsLinksWithSafeAttributes(): void { $html = '

Lien

'; self::assertSame($html, $this->sanitizer->sanitize($html)); } #[Test] public function itStripsScriptTags(): void { $result = $this->sanitizer->sanitize('

Texte

'); self::assertStringNotContainsString('