function UserTestBase::setUp

Same name and namespace in other branches
  1. 8.9.x core/modules/user/tests/src/Functional/Views/UserTestBase.php \Drupal\Tests\user\Functional\Views\UserTestBase::setUp()
  2. 10 core/modules/user/tests/src/Functional/Views/UserTestBase.php \Drupal\Tests\user\Functional\Views\UserTestBase::setUp()
  3. 11.x core/modules/user/tests/src/Functional/Views/UserTestBase.php \Drupal\Tests\user\Functional\Views\UserTestBase::setUp()

Sets up the test.

Parameters

bool $import_test_views: Should the views specified on the test class be imported. If you need to setup some additional stuff, like fields, you need to call false and then call createTestViews for your own.

array $modules: The module directories to look in for test views.

Overrides ViewTestBase::setUp

1 call to UserTestBase::setUp()
AccessTestBase::setUp in core/modules/user/tests/src/Functional/Views/AccessTestBase.php
Sets up the test.
1 method overrides UserTestBase::setUp()
AccessTestBase::setUp in core/modules/user/tests/src/Functional/Views/AccessTestBase.php
Sets up the test.

File

core/modules/user/tests/src/Functional/Views/UserTestBase.php, line 37

Class

UserTestBase
@todo.

Namespace

Drupal\Tests\user\Functional\Views

Code

protected function setUp($import_test_views = TRUE, $modules = [
    'user_test_views',
]) {
    parent::setUp($import_test_views, $modules);
    $this->users[] = $this->drupalCreateUser();
    $this->users[] = User::load(1);
    $this->nodes[] = $this->drupalCreateNode([
        'uid' => $this->users[0]
            ->id(),
    ]);
    $this->nodes[] = $this->drupalCreateNode([
        'uid' => 1,
    ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.