class FilterNoFormatTest in Drupal 10
Same name and namespace in other branches
- 8 core/modules/filter/tests/src/Kernel/FilterNoFormatTest.php \Drupal\Tests\filter\Kernel\FilterNoFormatTest
- 9 core/modules/filter/tests/src/Kernel/FilterNoFormatTest.php \Drupal\Tests\filter\Kernel\FilterNoFormatTest
Tests the behavior of check_markup() when it is called without text format.
@group filter
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \PHPUnit\Framework\TestCase implements ServiceProviderInterface uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, AssertContentTrait, ConfigTestTrait, ExtensionListTestTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings
- class \Drupal\Tests\filter\Kernel\FilterNoFormatTest
Expanded class hierarchy of FilterNoFormatTest
File
- core/
modules/ filter/ tests/ src/ Kernel/ FilterNoFormatTest.php, line 12
Namespace
Drupal\Tests\filter\KernelView source
class FilterNoFormatTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'filter',
];
/**
* Tests text without format.
*
* Tests if text with no format is filtered the same way as text in the
* fallback format.
*/
public function testCheckMarkupNoFormat() {
$this
->installConfig([
'filter',
]);
// Create some text. Include some HTML and line breaks, so we get a good
// test of the filtering that is applied to it.
$text = "<strong>" . $this
->randomMachineName(32) . "</strong>\n\n<div>" . $this
->randomMachineName(32) . "</div>";
// Make sure that when this text is run through check_markup() with no text
// format, it is filtered as though it is in the fallback format.
$this
->assertEquals(check_markup($text), check_markup($text, filter_fallback_format()));
}
}