function ElementsVerticalTabsTest::testWrapperNotShownWhenEmpty

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

File

drupal/core/modules/system/lib/Drupal/system/Tests/Form/ElementsVerticalTabsTest.php, line 55
Definition of Drupal\system\Tests\Form\ElementsVerticalTabsTest.

Class

ElementsVerticalTabsTest
Test the vertical_tabs form element for expected behavior.

Namespace

Drupal\system\Tests\Form

Code

function testWrapperNotShownWhenEmpty() {

  // Test admin user can see vertical tabs and wrapper.
  $this
    ->drupalGet('form_test/vertical-tabs');
  $wrapper = $this
    ->xpath("//div[@class='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->web_user);
  $this
    ->drupalGet('form_test/vertical-tabs');
  $wrapper = $this
    ->xpath("//div[@class='vertical-tabs-panes']");
  $this
    ->assertFalse(isset($wrapper[0]), 'Vertical tab wrappers are not displayed to unprivileged users.');
}