1<?php 2 3namespace Drupal\Tests\filter\Kernel; 4 5use Drupal\KernelTests\KernelTestBase; 6 7/** 8 * Tests the behavior of check_markup() when it is called without text format. 9 * 10 * @group filter 11 */ 12class FilterNoFormatTest extends KernelTestBase { 13 14 /** 15 * {@inheritdoc} 16 */ 17 protected static $modules = ['filter']; 18 19 /** 20 * Tests text without format. 21 * 22 * Tests if text with no format is filtered the same way as text in the 23 * fallback format. 24 */ 25 public function testCheckMarkupNoFormat() { 26 $this->installConfig(['filter']); 27 28 // Create some text. Include some HTML and line breaks, so we get a good 29 // test of the filtering that is applied to it. 30 $text = "<strong>" . $this->randomMachineName(32) . "</strong>\n\n<div>" . $this->randomMachineName(32) . "</div>"; 31 32 // Make sure that when this text is run through check_markup() with no text 33 // format, it is filtered as though it is in the fallback format. 34 $this->assertEquals(check_markup($text), check_markup($text, filter_fallback_format())); 35 } 36 37} 38