function FieldEntityLinkTest::setUpFixtures

Same name and namespace 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. 10 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 47

Class

FieldEntityLinkTest
Tests the core <a href="/api/drupal/core%21modules%21views%21src%21Plugin%21views%21field%21EntityOperations.php/class/EntityOperations/11.x" title="Renders all operations links for an entity." class="local">Drupal\views\Plugin\views\field\EntityOperations</a> 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.