You are here

protected function TextFormatElementFormTest::setUp in Zircon Profile 8.0

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

Sets up the test.

Overrides KernelTestBase::setUp

File

core/modules/filter/src/Tests/TextFormatElementFormTest.php, line 41
Contains \Drupal\filter\Tests\TextFormatElementFormTest.

Class

TextFormatElementFormTest
Tests PathElement validation and conversion functionality.

Namespace

Drupal\filter\Tests

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('user');
  $this
    ->installSchema('system', [
    'sequences',
    'router',
  ]);
  $this
    ->installConfig([
    'filter',
    'filter_test',
  ]);

  // Filter tips link to the full-page.
  \Drupal::service('router.builder')
    ->rebuild();

  /* @var \Drupal\Core\Render\ElementInfoManager $manager */
  $manager = \Drupal::service('plugin.manager.element_info');
  $manager
    ->clearCachedDefinitions();
  $manager
    ->getDefinitions();

  /* @var \Drupal\filter\FilterFormatInterface $filter_test_format */
  $filter_test_format = FilterFormat::load('filter_test');

  /* @var \Drupal\user\RoleInterface $role */
  $role = Role::create([
    'id' => 'admin',
    'label' => 'admin',
  ]);
  $role
    ->grantPermission($filter_test_format
    ->getPermissionName());
  $role
    ->save();
  $this->testUser = User::create([
    'name' => 'foobar',
    'mail' => 'foobar@example.com',
  ]);
  $this->testUser
    ->addRole($role
    ->id());
  $this->testUser
    ->save();
  \Drupal::service('current_user')
    ->setAccount($this->testUser);
}