| @@ 42-50 (lines=9) @@ | ||
| 39 | /** |
|
| 40 | * Test {@link Text->LimitCharacters()} |
|
| 41 | */ |
|
| 42 | public function providerLimitCharacters() |
|
| 43 | { |
|
| 44 | // HTML characters are stripped safely |
|
| 45 | return [ |
|
| 46 | ['The little brown fox jumped over the lazy cow.', 'The little brown fox...'], |
|
| 47 | ['<p>Short & Sweet</p>', 'Short & Sweet'], |
|
| 48 | ['This text contains & in it', 'This text contains &...'], |
|
| 49 | ]; |
|
| 50 | } |
|
| 51 | ||
| 52 | /** |
|
| 53 | * Test {@link DBHTMLText->LimitCharacters()} |
|
| @@ 240-256 (lines=17) @@ | ||
| 237 | $this->assertEquals(['a'], $field->getWhitelist()); |
|
| 238 | } |
|
| 239 | ||
| 240 | public function providerToPlain() |
|
| 241 | { |
|
| 242 | return [ |
|
| 243 | [ |
|
| 244 | '<p><img />Lots of <strong>HTML <i>nested</i></strong> tags', |
|
| 245 | 'Lots of HTML nested tags', |
|
| 246 | ], |
|
| 247 | [ |
|
| 248 | '<p>Multi</p><p>Paragraph<br>Also has multilines.</p>', |
|
| 249 | "Multi\n\nParagraph\nAlso has multilines.", |
|
| 250 | ], |
|
| 251 | [ |
|
| 252 | '<p>Collapses</p><p></p><p>Excessive<br/><br /><br>Newlines</p>', |
|
| 253 | "Collapses\n\nExcessive\n\nNewlines", |
|
| 254 | ] |
|
| 255 | ]; |
|
| 256 | } |
|
| 257 | ||
| 258 | /** |
|
| 259 | * @dataProvider providerToPlain |
|
| @@ 22-31 (lines=10) @@ | ||
| 19 | /** |
|
| 20 | * Test {@link Text->LimitCharacters()} |
|
| 21 | */ |
|
| 22 | public function providerLimitCharacters() |
|
| 23 | { |
|
| 24 | // Plain text values always encoded safely |
|
| 25 | // HTML stored in non-html fields is treated literally. |
|
| 26 | return [ |
|
| 27 | ['The little brown fox jumped over the lazy cow.', 'The little brown fox...'], |
|
| 28 | ['<p>Short & Sweet</p>', '<p>Short & Sweet</p>'], |
|
| 29 | ['This text contains & in it', 'This text contains &...'], |
|
| 30 | ]; |
|
| 31 | } |
|
| 32 | ||
| 33 | /** |
|
| 34 | * Test {@link Text->LimitCharacters()} |
|