You are here

public function FieldEntityLinkBaseTest::testEntityLink in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Functional/Handler/FieldEntityLinkBaseTest.php \Drupal\Tests\views\Functional\Handler\FieldEntityLinkBaseTest::testEntityLink()

Tests entity link fields.

File

core/modules/views/tests/src/Functional/Handler/FieldEntityLinkBaseTest.php, line 67

Class

FieldEntityLinkBaseTest
Tests the core Drupal\views\Plugin\views\field\LinkBase handler.

Namespace

Drupal\Tests\views\Functional\Handler

Code

public function testEntityLink() {
  $this
    ->drupalGet('test-link-base-links');
  $session = $this
    ->assertSession();

  // Tests 'Link to Content'.
  $session
    ->linkByHrefExists('/node/1');
  $session
    ->linkByHrefExists('/es/node/1');
  $session
    ->linkByHrefExists('/hu/node/2');
  $session
    ->linkByHrefExists('/es/node/2');

  // Tests 'Link to delete Content'.
  $session
    ->linkByHrefExists('/node/1/delete');
  $session
    ->linkByHrefExists('/es/node/1/delete');
  $session
    ->linkByHrefExists('/hu/node/2/delete');
  $session
    ->linkByHrefExists('/es/node/2/delete');

  // Tests 'Link to edit Content'.
  $session
    ->linkByHrefExists('/node/1/edit');
  $session
    ->linkByHrefExists('/es/node/1/edit');
  $session
    ->linkByHrefExists('/hu/node/2/edit');
  $session
    ->linkByHrefExists('/es/node/2/edit');

  // Tests the second 'Link to Content' rendered as text.
  $session
    ->pageTextContains('/node/1');
  $session
    ->pageTextContains('/es/node/1');
  $session
    ->pageTextContains('/hu/node/2');
  $session
    ->pageTextContains('/es/node/2');
}