You are here

public function EntityDisplayTest::testFieldset in Field Group 8

Same name and namespace in other branches
  1. 8.3 tests/src/Functional/EntityDisplayTest.php \Drupal\Tests\field_group\Functional\EntityDisplayTest::testFieldset()

Test the fieldset formatter.

File

tests/src/Functional/EntityDisplayTest.php, line 182

Class

EntityDisplayTest
Tests for displaying entities.

Namespace

Drupal\Tests\field_group\Functional

Code

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

  // Test group ids and classes.
  $this
    ->assertFieldByXPath("//fieldset[contains(@id, 'fieldset-id')]", NULL, 'Correct id set on the fieldset');
  $this
    ->assertFieldByXPath("//fieldset[contains(@class, 'test-class')]", NULL, 'Test class set on the fieldset');
}