function FieldEntityLinkBaseTest::testEntityLink

Same name in other branches
  1. 9 core/modules/views/tests/src/Functional/Handler/FieldEntityLinkBaseTest.php \Drupal\Tests\views\Functional\Handler\FieldEntityLinkBaseTest::testEntityLink()
  2. 8.9.x core/modules/views/tests/src/Functional/Handler/FieldEntityLinkBaseTest.php \Drupal\Tests\views\Functional\Handler\FieldEntityLinkBaseTest::testEntityLink()
  3. 11.x 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 73

Class

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

Namespace

Drupal\Tests\views\Functional\Handler

Code

public function testEntityLink() : void {
    $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');
}

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