function BlogTestCase::testUnprivilegedUser
Confirm that the "You are not allowed to post a new blog entry." message shows up if a user submitted blog entries, has been denied that permission, and goes to the blog page.
File
-
modules/
blog/ blog.test, line 37
Class
- BlogTestCase
- @file Tests for blog.module.
Code
function testUnprivilegedUser() {
// Create a blog node for a user with no blog permissions.
$this->drupalCreateNode(array(
'type' => 'blog',
'uid' => $this->big_user->uid,
));
$this->drupalLogin($this->big_user);
$this->drupalGet('blog/' . $this->big_user->uid);
$this->assertResponse(200);
$this->assertTitle(t("@name's blog", array(
'@name' => format_username($this->big_user),
)) . ' | Drupal', 'Blog title was displayed');
$this->assertText(t('You are not allowed to post a new blog entry.'), 'No new entries can be posted without the right permission');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.