You are here

protected function PathElementFormTest::setUp in Zircon Profile 8

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

Sets up the test.

Overrides KernelTestBase::setUp

File

core/modules/system/src/Tests/Element/PathElementFormTest.php, line 43
Contains \Drupal\system\Tests\Element\PathElementFormTest.

Class

PathElementFormTest
Tests PathElement validation and conversion functionality.

Namespace

Drupal\system\Tests\Element

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installSchema('system', [
    'router',
    'sequences',
    'key_value_expire',
  ]);
  $this
    ->installEntitySchema('user');
  \Drupal::service('router.builder')
    ->rebuild();

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