comparison core/modules/text/tests/src/Kernel/TextSummaryTest.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
206 $this->assertTextSummary($text, "<p>\nHi\n</p>\n<p>\nfolks\n<br />\n!\n</p>", $format, $i++); 206 $this->assertTextSummary($text, "<p>\nHi\n</p>\n<p>\nfolks\n<br />\n!\n</p>", $format, $i++);
207 $this->assertTextSummary($text, "<p>\nHi\n</p>\n<p>\nfolks\n<br />\n!\n</p>", $format, $i++); 207 $this->assertTextSummary($text, "<p>\nHi\n</p>\n<p>\nfolks\n<br />\n!\n</p>", $format, $i++);
208 } 208 }
209 209
210 /** 210 /**
211 * Test text_summary() returns an empty string without any error when called
212 * with an invalid format.
213 */
214 public function testInvalidFilterFormat() {
215
216 $this->assertTextSummary($this->randomString(100), '', 'non_existent_format');
217 }
218
219 /**
211 * Calls text_summary() and asserts that the expected teaser is returned. 220 * Calls text_summary() and asserts that the expected teaser is returned.
212 */ 221 */
213 public function assertTextSummary($text, $expected, $format = NULL, $size = NULL) { 222 public function assertTextSummary($text, $expected, $format = NULL, $size = NULL) {
214 $summary = text_summary($text, $format, $size); 223 $summary = text_summary($text, $format, $size);
215 $this->assertIdentical($summary, $expected, format_string('<pre style="white-space: pre-wrap">@actual</pre> is identical to <pre style="white-space: pre-wrap">@expected</pre>', [ 224 $this->assertIdentical($summary, $expected, format_string('<pre style="white-space: pre-wrap">@actual</pre> is identical to <pre style="white-space: pre-wrap">@expected</pre>', [