1 admin_bar.test | AdminBarPermissionsTestCase::testCategories() |
Tests handling of links pointing to category/overview pages.
File
- core/
modules/ admin_bar/ tests/ admin_bar.test, line 170 - Tests for the Administration bar module.
Class
- AdminBarPermissionsTestCase
- Tests menu links depending on user permissions.
Code
function testCategories() {
// Create a user with minimum permissions.
$admin_user = $this->backdropCreateUser($this->basePermissions);
$this->backdropLogin($admin_user);
// Verify that no category links appear.
$this->assertNoLinkTrailByTitle(array(t('Structure')));
$this->assertNoLinkTrailByTitle(array(t('Configuration')));
// Create a user with access to one configuration category.
$permissions = $this->basePermissions + array(
'administer users',
'administer account settings',
);
$admin_user = $this->backdropCreateUser($permissions);
$this->backdropLogin($admin_user);
// Verify that only expected category links appear.
$this->assertNoLinkTrailByTitle(array(t('Structure')));
$this->assertLinkTrailByTitle(array(t('User accounts')));
$this->assertLinkTrailByTitle(array(t('Configuration')));
$this->assertLinkTrailByTitle(array(t('Configuration'), t('User accounts')));
// Random picks are sufficient.
$this->assertNoLinkTrailByTitle(array(t('Configuration'), t('Media')));
$this->assertNoLinkTrailByTitle(array(t('Configuration'), t('System')));
}