function BlogTestCase::testUnprivilegedUser

7.x blog.test 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

drupal-7.x/modules/blog/blog.test, line 37
Tests for blog.module.

Class

BlogTestCase

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');
}