You are here

public function FixedTextLinkTest::testRegression3054339 in Fixed text link formatter 8

Tests that the title override works correctly.

File

tests/src/Functional/FixedTextLinkTest.php, line 115

Class

FixedTextLinkTest
Tests the correct function of the Fixed Text Link formatter.

Namespace

Drupal\Tests\fixed_text_link_formatter\Functional

Code

public function testRegression3054339() {
  $linkText = 'View amazing website';
  $this->entityDisplayRepository
    ->getViewDisplay('node', $this->nodeType
    ->id(), 'full')
    ->setComponent($this->linkFieldName, [
    'type' => 'fixed_text_link',
    'settings' => [
      'link_text' => $linkText,
      'allow_override' => TRUE,
    ],
  ])
    ->save();
  $overrideText = 'Override test';
  $node = $this
    ->createNode([
    'type' => $this->nodeType
      ->id(),
    $this->linkFieldName => [
      'uri' => 'http://example.com/test',
      'title' => $overrideText,
    ],
  ]);
  $this
    ->getSession()
    ->visit($node
    ->toUrl()
    ->toString());
  $this
    ->assertSession()
    ->linkExists($overrideText);
  $this
    ->assertSession()
    ->pageTextNotContains($linkText);
}