You are here

public function EntityDisplayTest::testFieldAccess in Field Group 8.3

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

Test field access for field groups.

File

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

Class

EntityDisplayTest
Tests for displaying entities.

Namespace

Drupal\Tests\field_group\Functional

Code

public function testFieldAccess() {
  $data = [
    'label' => 'Wrapper',
    'children' => [
      0 => 'field_no_access',
    ],
    'format_type' => 'html_element',
    'format_settings' => [
      'element' => 'div',
      'id' => 'wrapper-id',
    ],
  ];
  $this
    ->createGroup('node', $this->type, 'view', 'default', $data);
  $this
    ->drupalGet('node/' . $this->node
    ->id());

  // Test if group is not shown.
  $this
    ->assertEmpty($this
    ->xpath("//div[contains(@id, 'wrapper-id')]"), t('Div that contains fields with no access is not shown.'));
}