You are here

function ElementsVerticalTabsTest::testWrapperNotShownWhenEmpty in Zircon Profile 8

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

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

File

core/modules/system/src/Tests/Form/ElementsVerticalTabsTest.php, line 65
Contains \Drupal\system\Tests\Form\ElementsVerticalTabsTest.

Class

ElementsVerticalTabsTest
Tests 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[@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.');
}