function PathElementFormTest::setUp
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Element/PathElementFormTest.php \Drupal\KernelTests\Core\Element\PathElementFormTest::setUp()
- 8.9.x core/tests/Drupal/KernelTests/Core/Element/PathElementFormTest.php \Drupal\KernelTests\Core\Element\PathElementFormTest::setUp()
- 11.x core/tests/Drupal/KernelTests/Core/Element/PathElementFormTest.php \Drupal\KernelTests\Core\Element\PathElementFormTest::setUp()
Sets up the test.
Overrides KernelTestBase::setUp
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Element/ PathElementFormTest.php, line 38
Class
- PathElementFormTest
- Tests PathElement validation and conversion functionality.
Namespace
Drupal\KernelTests\Core\ElementCode
protected function setUp() : void {
parent::setUp();
$this->installEntitySchema('user');
/** @var \Drupal\user\RoleInterface $role */
$role = Role::create([
'id' => 'admin',
'label' => 'admin',
]);
$role->grantPermission('link to any page');
$role->save();
$this->testUser = User::create([
'name' => 'foobar',
'mail' => 'foobar@example.com',
]);
$this->testUser
->addRole($role->id())
->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.