function FieldEntityLinkTest::setUpFixtures

Same name in other branches
  1. 9 core/modules/views/tests/src/Kernel/Handler/FieldEntityLinkTest.php \Drupal\Tests\views\Kernel\Handler\FieldEntityLinkTest::setUpFixtures()
  2. 8.9.x core/modules/views/tests/src/Kernel/Handler/FieldEntityLinkTest.php \Drupal\Tests\views\Kernel\Handler\FieldEntityLinkTest::setUpFixtures()
  3. 11.x core/modules/views/tests/src/Kernel/Handler/FieldEntityLinkTest.php \Drupal\Tests\views\Kernel\Handler\FieldEntityLinkTest::setUpFixtures()

Overrides ViewsKernelTestBase::setUpFixtures

File

core/modules/views/tests/src/Kernel/Handler/FieldEntityLinkTest.php, line 45

Class

FieldEntityLinkTest
Tests the core Drupal\views\Plugin\views\field\EntityOperations handler.

Namespace

Drupal\Tests\views\Kernel\Handler

Code

protected function setUpFixtures() {
    parent::setUpFixtures();
    // Create the anonymous user account and set it as current user.
    $this->setUpCurrentUser([
        'uid' => 0,
    ]);
    $this->installEntitySchema('entity_test');
    $this->installConfig([
        'user',
    ]);
    // Create some test entities.
    for ($i = 0; $i < 5; $i++) {
        EntityTest::create([
            'name' => $this->randomString(),
        ])
            ->save();
    }
    // Create and admin user.
    $this->adminUser = $this->createUser([
        'view test entity',
    ], FALSE, TRUE);
    Role::load(AccountInterface::ANONYMOUS_ROLE)->grantPermission('view test entity')
        ->save();
}

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