You are here

public function ElementsVerticalTabsTest::testWrapperNotShownWhenEmpty in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/system/tests/src/Functional/Form/ElementsVerticalTabsTest.php \Drupal\Tests\system\Functional\Form\ElementsVerticalTabsTest::testWrapperNotShownWhenEmpty()

Ensures that vertical tab markup is not shown if user has no tab access.

File

core/modules/system/tests/src/Functional/Form/ElementsVerticalTabsTest.php, line 68

Class

ElementsVerticalTabsTest
Tests the vertical_tabs form element for expected behavior.

Namespace

Drupal\Tests\system\Functional\Form

Code

public function testWrapperNotShownWhenEmpty() {

  // Test admin user can see vertical tabs and wrapper.
  $this
    ->drupalGet('form_test/vertical-tabs');
  $wrapper = $this
    ->xpath("//div[@data-vertical-tabs-panes]");
  $this
    ->assertTrue(isset($wrapper[0]), 'Vertical tab panes found.');

  // Test wrapper markup not present for non-privileged web user.
  $this
    ->drupalLogin($this->webUser);
  $this
    ->drupalGet('form_test/vertical-tabs');
  $wrapper = $this
    ->xpath("//div[@data-vertical-tabs-panes]");
  $this
    ->assertFalse(isset($wrapper[0]), 'Vertical tab wrappers are not displayed to unprivileged users.');
}