function ElementsVerticalTabsTest::testWrapperNotShownWhenEmpty

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/Form/ElementsVerticalTabsTest.php \Drupal\Tests\system\Functional\Form\ElementsVerticalTabsTest::testWrapperNotShownWhenEmpty()
  2. 10 core/modules/system/tests/src/Functional/Form/ElementsVerticalTabsTest.php \Drupal\Tests\system\Functional\Form\ElementsVerticalTabsTest::testWrapperNotShownWhenEmpty()
  3. 11.x 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.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.