diff options
Diffstat (limited to 'modules/simpletest/tests/form.test')
-rw-r--r-- | modules/simpletest/tests/form.test | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/modules/simpletest/tests/form.test b/modules/simpletest/tests/form.test index 675e8d189..08d2fcacc 100644 --- a/modules/simpletest/tests/form.test +++ b/modules/simpletest/tests/form.test @@ -930,6 +930,10 @@ class FormsElementsVerticalTabsFunctionalTest extends DrupalWebTestCase { function setUp() { parent::setUp('form_test'); + + $this->admin_user = $this->drupalCreateUser(array('access vertical_tab_test tabs')); + $this->web_user = $this->drupalCreateUser(); + $this->drupalLogin($this->admin_user); } /** @@ -943,6 +947,22 @@ class FormsElementsVerticalTabsFunctionalTest extends DrupalWebTestCase { $position2 = strpos($this->content, 'misc/collapse.js'); $this->assertTrue($position1 !== FALSE && $position2 !== FALSE && $position1 < $position2, t('vertical-tabs.js is included before collapse.js')); } + + /** + * Ensures that vertical tab markup is not shown if user has no tab access. + */ + 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.'); + } } /** |