You are here

public function NodeTitleBuiltinFailoverTest::testNodeTitleShowtextFailover in Freelinking 4.0.x

Same name and namespace in other branches
  1. 8.3 tests/src/Functional/NodeTitleBuiltinFailoverTest.php \Drupal\Tests\freelinking\Functional\NodeTitleBuiltinFailoverTest::testNodeTitleShowtextFailover()

Asserts that showtext failover option is functional.

Throws

\Behat\Mink\Exception\ResponseTextException

\Behat\Mink\Exception\ExpectationException

File

tests/src/Functional/NodeTitleBuiltinFailoverTest.php, line 36

Class

NodeTitleBuiltinFailoverTest
Tests the "showtext" builtin failover plugin with node title.

Namespace

Drupal\Tests\freelinking\Functional

Code

public function testNodeTitleShowtextFailover() {

  // Create node that will contain a sample of each plugin.
  $edit = [];
  $edit['title[0][value]'] = t('Testing all freelinking plugins');
  $edit['body[0][value]'] = $this
    ->getNodeBodyValue();
  $this
    ->drupalGet('node/add/page');
  $this
    ->submitForm($edit, 'Save');
  $this
    ->assertSession()
    ->pageTextContains(t('Basic page @title has been created.', [
    '@title' => $edit['title[0][value]'],
  ]));

  // Verify each freelink plugin.
  $this
    ->assertSession()
    ->linkNotExists('Third page', 'No link exists for the third page.');
  $this
    ->assertSession()
    ->pageTextContainsOnce('Third page');
}