You are here

protected function FilterSecurityTest::setUp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/filter/src/Tests/FilterSecurityTest.php \Drupal\filter\Tests\FilterSecurityTest::setUp()

Sets up a Drupal site for running functional and integration tests.

Installs Drupal with the installation profile specified in \Drupal\simpletest\WebTestBase::$profile into the prefixed database.

Afterwards, installs any additional modules specified in the static \Drupal\simpletest\WebTestBase::$modules property of each class in the class hierarchy.

After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.

Overrides WebTestBase::setUp

File

core/modules/filter/src/Tests/FilterSecurityTest.php, line 37
Contains \Drupal\filter\Tests\FilterSecurityTest.

Class

FilterSecurityTest
Tests the behavior of check_markup() when a filter or text format vanishes, or when check_markup() is called in such a way that it is instructed to skip all filters of the "FilterInterface::TYPE_HTML_RESTRICTOR" type.

Namespace

Drupal\filter\Tests

Code

protected function setUp() {
  parent::setUp();

  // Create Basic page node type.
  $this
    ->drupalCreateContentType(array(
    'type' => 'page',
    'name' => 'Basic page',
  ));

  /** @var \Drupal\filter\Entity\FilterFormat $filtered_html_format */
  $filtered_html_format = entity_load('filter_format', 'filtered_html');
  $filtered_html_permission = $filtered_html_format
    ->getPermissionName();
  user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, array(
    $filtered_html_permission,
  ));
  $this->adminUser = $this
    ->drupalCreateUser(array(
    'administer modules',
    'administer filters',
    'administer site configuration',
  ));
  $this
    ->drupalLogin($this->adminUser);
}