You are here

public function ThunderParagraphsTestTrait::addLinkParagraph in Thunder 8.2

Same name and namespace in other branches
  1. 8.5 tests/src/FunctionalJavascript/ThunderParagraphsTestTrait.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderParagraphsTestTrait::addLinkParagraph()
  2. 8.3 tests/src/FunctionalJavascript/ThunderParagraphsTestTrait.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderParagraphsTestTrait::addLinkParagraph()
  3. 8.4 tests/src/FunctionalJavascript/ThunderParagraphsTestTrait.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderParagraphsTestTrait::addLinkParagraph()
  4. 6.2.x tests/src/FunctionalJavascript/ThunderParagraphsTestTrait.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderParagraphsTestTrait::addLinkParagraph()
  5. 6.0.x tests/src/FunctionalJavascript/ThunderParagraphsTestTrait.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderParagraphsTestTrait::addLinkParagraph()
  6. 6.1.x tests/src/FunctionalJavascript/ThunderParagraphsTestTrait.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderParagraphsTestTrait::addLinkParagraph()

Add link paragraph.

Parameters

string $fieldName: Field name.

string $urlText: Text that will be displayed for link.

string $url: Link url.

int $position: Position of the paragraph.

2 calls to ThunderParagraphsTestTrait::addLinkParagraph()
ArticleCreationTest::testCreateArticle in tests/src/FunctionalJavascript/ArticleCreationTest.php
Test Creation of Article.
NestedTableDragTest::testNestedTableSorting in tests/src/FunctionalJavascript/Integration/NestedTableDragTest.php
Test tabledrag sorting in nested table.

File

tests/src/FunctionalJavascript/ThunderParagraphsTestTrait.php, line 230

Class

ThunderParagraphsTestTrait
Trait for handling of Paragraph related test actions.

Namespace

Drupal\Tests\thunder\FunctionalJavascript

Code

public function addLinkParagraph($fieldName, $urlText, $url, $position = NULL) {
  $paragraphIndex = $this
    ->addParagraph($fieldName, 'link', $position);

  /** @var \Behat\Mink\Element\DocumentElement $page */
  $page = $this
    ->getSession()
    ->getPage();
  $page
    ->fillField("{$fieldName}[{$paragraphIndex}][subform][field_link][0][title]", $urlText);
  $page
    ->fillField("{$fieldName}[{$paragraphIndex}][subform][field_link][0][uri]", $url);
}