function TextFormatElementFormTest::setUp
Same name in other branches
- 9 core/modules/filter/tests/src/Kernel/TextFormatElementFormTest.php \Drupal\Tests\filter\Kernel\TextFormatElementFormTest::setUp()
- 10 core/modules/filter/tests/src/Kernel/TextFormatElementFormTest.php \Drupal\Tests\filter\Kernel\TextFormatElementFormTest::setUp()
- 11.x core/modules/filter/tests/src/Kernel/TextFormatElementFormTest.php \Drupal\Tests\filter\Kernel\TextFormatElementFormTest::setUp()
Sets up the test.
Overrides KernelTestBase::setUp
File
-
core/
modules/ filter/ tests/ src/ Kernel/ TextFormatElementFormTest.php, line 42
Class
- TextFormatElementFormTest
- Tests PathElement validation and conversion functionality.
Namespace
Drupal\Tests\filter\KernelCode
protected function setUp() {
parent::setUp();
$this->installEntitySchema('user');
$this->installSchema('system', [
'sequences',
]);
$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);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.