function FilterHtmlImageSecureTest::setUp
Same name in other branches
- 9 core/modules/filter/tests/src/Functional/FilterHtmlImageSecureTest.php \Drupal\Tests\filter\Functional\FilterHtmlImageSecureTest::setUp()
- 8.9.x core/modules/filter/tests/src/Functional/FilterHtmlImageSecureTest.php \Drupal\Tests\filter\Functional\FilterHtmlImageSecureTest::setUp()
- 10 core/modules/filter/tests/src/Functional/FilterHtmlImageSecureTest.php \Drupal\Tests\filter\Functional\FilterHtmlImageSecureTest::setUp()
Overrides BrowserTestBase::setUp
File
-
core/
modules/ filter/ tests/ src/ Functional/ FilterHtmlImageSecureTest.php, line 36
Class
- FilterHtmlImageSecureTest
- Tests restriction of IMG tags in HTML input.
Namespace
Drupal\Tests\filter\FunctionalCode
protected function setUp() : void {
parent::setUp();
// Setup Filtered HTML text format.
$filtered_html_format = FilterFormat::create([
'format' => 'filtered_html',
'name' => 'Filtered HTML',
'filters' => [
'filter_html' => [
'status' => 1,
'settings' => [
'allowed_html' => '<img src test-attribute> <a>',
],
],
'filter_autop' => [
'status' => 1,
],
'filter_html_image_secure' => [
'status' => 1,
],
],
]);
$filtered_html_format->save();
// Setup users.
$webUser = $this->drupalCreateUser([
'access content',
'access comments',
'post comments',
'skip comment approval',
$filtered_html_format->getPermissionName(),
]);
$this->drupalLogin($webUser);
// Setup a node to comment and test on.
$this->drupalCreateContentType([
'type' => 'page',
'name' => 'Basic page',
]);
// Add a comment field.
$this->addDefaultCommentField('node', 'page');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.