function FieldEntityLinkTest::testEntityLink

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

Tests entity link fields.

File

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

Class

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

Namespace

Drupal\Tests\views\Kernel\Handler

Code

public function testEntityLink() {
    // Anonymous users cannot see edit/delete links.
    $expected_results = [
        'canonical' => TRUE,
        'edit-form' => FALSE,
        'delete-form' => FALSE,
        'canonical_raw' => TRUE,
        'canonical_raw_absolute' => TRUE,
    ];
    $this->doTestEntityLink(\Drupal::currentUser(), $expected_results);
    // Admin users cannot see all links.
    $expected_results = [
        'canonical' => TRUE,
        'edit-form' => TRUE,
        'delete-form' => TRUE,
        'canonical_raw' => TRUE,
        'canonical_raw_absolute' => TRUE,
    ];
    $this->doTestEntityLink($this->adminUser, $expected_results);
}

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