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. 8.9.x core/modules/system/tests/src/Functional/Form/ElementsVerticalTabsTest.php \Drupal\Tests\system\Functional\Form\ElementsVerticalTabsTest::testWrapperNotShownWhenEmpty()
  3. 10 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 57

Class

ElementsVerticalTabsTest
Tests the vertical_tabs form element for expected behavior.

Namespace

Drupal\Tests\system\Functional\Form

Code

public function testWrapperNotShownWhenEmpty() : void {
    // Test admin user can see vertical tabs and wrapper.
    $this->drupalGet('form_test/vertical-tabs');
    $this->assertSession()
        ->elementExists('xpath', "//div[@data-vertical-tabs-panes]");
    // Test wrapper markup not present for non-privileged web user.
    $this->drupalLogin($this->webUser);
    $this->drupalGet('form_test/vertical-tabs');
    $this->assertSession()
        ->elementNotExists('xpath', "//div[@data-vertical-tabs-panes]");
}

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