19declare(strict_types=1);
23use PHPUnit\Framework\TestCase;
40 public function sanitize(
string $text):
string
50 string $replace_start,
55 [
'some text',
'some text'],
57 $search_start .
'some text' . $search_end,
58 $replace_start .
'some text' . $replace_end
61 'text' . $search_start .
'some text' . $search_end
62 .
'some more text' . $search_start .
'final text' . $search_end,
63 'text' . $replace_start .
'some text' . $replace_end .
64 'some more text' . $replace_start .
'final text' . $replace_end
66 [
'text' . $search_start .
'some text',
'text' . $search_start .
'some text'],
67 [
'text' . $search_end .
'some text',
'text' . $search_end .
'some text'],
69 $search_start .
'some text' . $search_end .
'text' . $search_end,
70 $replace_start .
'some text' . $replace_end .
'text' . $search_end
73 $search_start .
'text' . $search_start .
'some text' . $search_end,
74 $replace_start .
'text' . $search_start .
'some text' . $replace_end
77 $search_start .
'text' . $search_start .
'some text' . $search_end,
78 $replace_start .
'text' . $search_start .
'some text' . $replace_end
81 $search_start .
'text' . $search_start .
'some text' . $search_end .
'more text' . $search_end,
82 $replace_start .
'text' . $search_start .
'some text' . $replace_end .
'more text' . $search_end
90 [
'text' . self::PLACEHOLDER_START .
'more',
'textmore'],
91 [
'text' . self::PLACEHOLDER_END .
'more',
'textmore'],
93 'text' . self::PLACEHOLDER_START . self::HIGHLIGHT_START .
'more' . self::HIGHLIGHT_END,
94 'text' . self::PLACEHOLDER_START .
'more' . self::PLACEHOLDER_END
102 self::replacementMapProvider(
103 self::HIGHLIGHT_START,
105 self::PLACEHOLDER_START,
106 self::PLACEHOLDER_END
108 self::textWithInitialPlaceholdersProvider()
112 #[\PHPUnit\Framework\Attributes\DataProvider('setUpPlaceholdersProvider')]
115 string $expected_output
117 $sanitizer = $this->getSanitizerWithoutSanitization();
118 $output = $sanitizer->sanitizeAndSetUpPlaceholders($input);
119 $this->assertSame($expected_output, $output);
124 return self::replacementMapProvider(
125 self::PLACEHOLDER_START,
126 self::PLACEHOLDER_END,
127 self::HIGHLIGHT_START,
132 #[\PHPUnit\Framework\Attributes\DataProvider('replacePlaceholdersProvider')]
135 string $expected_output
137 $sanitizer = $this->getSanitizerWithoutSanitization();
138 $output = $sanitizer->replacePlaceholders($input);
139 $this->assertSame($expected_output, $output);
const string PLACEHOLDER_END
static setUpPlaceholdersProvider()
static textWithInitialPlaceholdersProvider()
getSanitizerWithoutSanitization()
const string HIGHLIGHT_START
const string PLACEHOLDER_START
static replacePlaceholdersProvider()
testSetUpPlaceholders(string $input, string $expected_output)
testReplacePlaceholders(string $input, string $expected_output)
static replacementMapProvider(string $search_start, string $search_end, string $replace_start, string $replace_end)
const string HIGHLIGHT_END
__construct()
Constructor setup ILIAS global object @access public.
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...