Class ilTermsOfServiceTrimmedDocumentPurifierTest.
More...
◆ stringElementsArrayToTrimProvider()
ilTermsOfServiceTrimmedDocumentPurifierTest::stringElementsArrayToTrimProvider |
( |
| ) |
|
- Returns
- array[]
Definition at line 24 of file ilTermsOfServiceTrimmedDocumentPurifierTest.php.
24 : array
25 {
26 return [
27 'Text with or without Spaces' => [[' phpunit '], ['phpunit'],],
28 'Text with or without Line Endings and Tabs' => [["\n\r\tphpunit\n\r\t"], ['phpunit'],],
29 ];
30 }
◆ stringsToTrimProvider()
ilTermsOfServiceTrimmedDocumentPurifierTest::stringsToTrimProvider |
( |
| ) |
|
- Returns
- array[]
Definition at line 13 of file ilTermsOfServiceTrimmedDocumentPurifierTest.php.
13 : array
14 {
15 return [
16 'Text with or without Spaces' => [' phpunit ', 'phpunit',],
17 'Text with or without Line Endings and Tabs' => ["\n\r\tphpunit\n\r\t", 'phpunit',],
18 ];
19 }
◆ testArrayOfStringElementsIsTrimmed()
ilTermsOfServiceTrimmedDocumentPurifierTest::testArrayOfStringElementsIsTrimmed |
( |
array |
$texts, |
|
|
array |
$expectedResult |
|
) |
| |
@dataProvider stringElementsArrayToTrimProvider
- Parameters
-
string[] | $texts | |
string[] | $expectedResult | |
- Exceptions
-
Definition at line 61 of file ilTermsOfServiceTrimmedDocumentPurifierTest.php.
61 : void
62 {
63 $aggregated = $this
64 ->getMockBuilder(ilHtmlPurifierInterface::class)
65 ->getMock();
66
67 $aggregated
68 ->expects($this->exactly(count($texts)))
69 ->method('purify')
70 ->with($this->isType('string'))
71 ->willReturnArgument(0);
72
74
75 $this->assertEquals($expectedResult, $purifier->purifyArray($texts));
76 }
Class ilTermsOfServiceTrimmedDocumentPurifier.
◆ testSingleStringIsTrimmed()
ilTermsOfServiceTrimmedDocumentPurifierTest::testSingleStringIsTrimmed |
( |
string |
$text, |
|
|
string |
$expectedResult |
|
) |
| |
@dataProvider stringsToTrimProvider
- Parameters
-
string | $text | |
string | $expectedResult | |
- Exceptions
-
Definition at line 38 of file ilTermsOfServiceTrimmedDocumentPurifierTest.php.
38 : void
39 {
40 $aggregated = $this
41 ->getMockBuilder(ilHtmlPurifierInterface::class)
42 ->getMock();
43
44 $aggregated
45 ->expects($this->once())
46 ->method('purify')
47 ->with($text)
48 ->willReturn($text);
49
51
52 $this->assertEquals($expectedResult, $purifier->purify($text));
53 }
The documentation for this class was generated from the following file: