You are here

public function EntityDisplayTest::testFieldAccess 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::testFieldAccess()

Test field access for field groups.

File

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

Class

EntityDisplayTest
Tests for displaying entities.

Namespace

Drupal\Tests\field_group\Functional

Code

public function testFieldAccess() {
  $data = array(
    'label' => 'Wrapper',
    'children' => array(
      0 => 'field_no_access',
    ),
    'format_type' => 'html_element',
    'format_settings' => array(
      '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
    ->assertNoFieldByXPath("//div[contains(@id, 'wrapper-id')]", NULL, t('Div that contains fields with no access is not shown.'));
}