You are here

public function FieldEntityLinkTest::testEntityLink in Drupal 8

Same name and namespace in other branches
  1. 9 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);
}