You are here

public function FieldGroupLinkDisplayTest::testLinkField in Field Group Link 8.3

Test the link module field type.

File

tests/src/Functional/FieldGroupLinkDisplayTest.php, line 220

Class

FieldGroupLinkDisplayTest
Tests for displaying entities.

Namespace

Drupal\Tests\field_group_link\Functional

Code

public function testLinkField() {
  $data = array(
    'weight' => '1',
    'children' => array(
      0 => 'field_test',
      1 => 'body',
    ),
    'label' => 'Test Link',
    'format_type' => 'link',
    'format_settings' => array(
      'target' => 'field_test_link',
      'classes' => 'test-link-class',
    ),
  );
  $this
    ->createGroup('node', $this->type, 'view', 'default', $data);
  $this
    ->drupalGet('node/' . $this->node
    ->id());

  // Test group ids and classes.
  $this
    ->click('.test-link-class');
  $this
    ->assertSession()
    ->addressEquals($this->referencedNode
    ->toUrl('canonical', [
    'absolute' => TRUE,
  ]));
}