public function AdminMenuDynamicLinksTestCase::testNodeAdd in Administration menu 7.3
Same name and namespace in other branches
- 6.3 tests/admin_menu.test \AdminMenuDynamicLinksTestCase::testNodeAdd()
Tests Add content links.
File
- tests/
admin_menu.test, line 346 - Tests for the Administration menu module.
Class
- AdminMenuDynamicLinksTestCase
- Tests appearance, localization, and escaping of dynamic links.
Code
public function testNodeAdd() {
$type = $this
->drupalCreateContentType(array(
'type' => 'article',
'name' => 'Article',
));
// Verify that "Add content" does not appear for unprivileged users.
$permissions = $this->basePermissions + array(
'access content',
);
$this->web_user = $this
->drupalCreateUser($permissions);
$this
->drupalLogin($this->web_user);
$this
->assertNoText(t('Add content'));
// Verify "Add content" appears below "Content" for administrative users.
$permissions = $this->basePermissions + array(
'access content overview',
'access content',
'create article content',
);
$this->admin_user = $this
->drupalCreateUser($permissions);
$this
->drupalLogin($this->admin_user);
$this
->assertLinkTrailByTitle(array(
t('Content'),
t('Add content'),
));
// Verify "Add content" appears on the top-level for regular users.
$permissions = $this->basePermissions + array(
'access content',
'create article content',
);
$this->web_user = $this
->drupalCreateUser($permissions);
$this
->drupalLogin($this->web_user);
$this
->assertLinkTrailByTitle(array(
t('Add content'),
));
}