function FilterSecurityTest::setUp

Same name in other branches
  1. 9 core/modules/filter/tests/src/Functional/FilterSecurityTest.php \Drupal\Tests\filter\Functional\FilterSecurityTest::setUp()
  2. 8.9.x core/modules/filter/tests/src/Functional/FilterSecurityTest.php \Drupal\Tests\filter\Functional\FilterSecurityTest::setUp()
  3. 10 core/modules/filter/tests/src/Functional/FilterSecurityTest.php \Drupal\Tests\filter\Functional\FilterSecurityTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/filter/tests/src/Functional/FilterSecurityTest.php, line 39

Class

FilterSecurityTest
Tests HTML filtering with missing or skipped filters or text formats.

Namespace

Drupal\Tests\filter\Functional

Code

protected function setUp() : void {
    parent::setUp();
    // Create Basic page node type.
    $this->drupalCreateContentType([
        'type' => 'page',
        'name' => 'Basic page',
    ]);
    
    /** @var \Drupal\filter\Entity\FilterFormat $filtered_html_format */
    $filtered_html_format = FilterFormat::load('filtered_html');
    $filtered_html_permission = $filtered_html_format->getPermissionName();
    user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, [
        $filtered_html_permission,
    ]);
    $this->adminUser = $this->drupalCreateUser([
        'administer modules',
        'administer filters',
        'administer site configuration',
    ]);
    $this->drupalLogin($this->adminUser);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.