function EntityReferenceSelectionAccessTest::setUp

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/Entity/EntityReferenceSelection/EntityReferenceSelectionAccessTest.php \Drupal\Tests\system\Functional\Entity\EntityReferenceSelection\EntityReferenceSelectionAccessTest::setUp()
  2. 8.9.x core/modules/system/tests/src/Functional/Entity/EntityReferenceSelection/EntityReferenceSelectionAccessTest.php \Drupal\Tests\system\Functional\Entity\EntityReferenceSelection\EntityReferenceSelectionAccessTest::setUp()
  3. 11.x core/modules/system/tests/src/Kernel/Entity/EntityReferenceSelection/EntityReferenceSelectionAccessTest.php \Drupal\Tests\system\Kernel\Entity\EntityReferenceSelection\EntityReferenceSelectionAccessTest::setUp()

Overrides KernelTestBase::setUp

File

core/modules/system/tests/src/Kernel/Entity/EntityReferenceSelection/EntityReferenceSelectionAccessTest.php, line 54

Class

EntityReferenceSelectionAccessTest
Tests for the base handlers provided by Entity Reference.

Namespace

Drupal\Tests\system\Kernel\Entity\EntityReferenceSelection

Code

protected function setUp() : void {
    parent::setUp();
    $this->installSchema('comment', [
        'comment_entity_statistics',
    ]);
    $this->installSchema('file', [
        'file_usage',
    ]);
    $this->installEntitySchema('comment');
    $this->installEntitySchema('file');
    $this->installEntitySchema('media');
    $this->installEntitySchema('node');
    $this->installEntitySchema('taxonomy_term');
    $this->installEntitySchema('user');
    $this->installConfig([
        'comment',
        'field',
        'media',
        'node',
        'taxonomy',
        'user',
    ]);
    // Create the anonymous and the admin users.
    $anonymous_user = User::create([
        'uid' => 0,
        'name' => '',
    ]);
    $anonymous_user->save();
    // Create role for administrator.
    $admin_user = User::create([
        'uid' => 1,
        'name' => 'admin',
        'status' => 1,
        'roles' => [
            $this->createRole([
                'administer users',
            ]),
        ],
    ]);
    $admin_user->save();
}

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