You are here

private function BlogTestCase::verifyBlogLinks in Drupal 7

Verify the blog links are displayed to the logged in user.

Parameters

object $user: The logged in user.

1 call to BlogTestCase::verifyBlogLinks()
BlogTestCase::doBasicTests in modules/blog/blog.test
Run basic tests on the indicated user.

File

modules/blog/blog.test, line 184
Tests for blog.module.

Class

BlogTestCase
@file Tests for blog.module.

Code

private function verifyBlogLinks($user) {

  // Confirm blog entries link exists on the user page.
  $this
    ->drupalGet('user/' . $user->uid);
  $this
    ->assertResponse(200);
  $this
    ->assertText(t('View recent blog entries'), 'View recent blog entries link was displayed');

  // Confirm the recent blog entries link goes to the user's blog page.
  $this
    ->clickLink('View recent blog entries');
  $this
    ->assertTitle(t("@name's blog | Drupal", array(
    '@name' => format_username($user),
  )), 'View recent blog entries link target was correct');

  // Confirm a blog page was displayed.
  $this
    ->drupalGet('blog');
  $this
    ->assertResponse(200);
  $this
    ->assertTitle('Blogs | Drupal', 'Blog page was displayed');
  $this
    ->assertText(t('Home'), 'Breadcrumbs were displayed');
  $this
    ->assertLink(t('Create new blog entry'));

  // Confirm a blog page was displayed per user.
  $this
    ->drupalGet('blog/' . $user->uid);
  $this
    ->assertTitle(t("@name's blog | Drupal", array(
    '@name' => format_username($user),
  )), 'User blog node was displayed');

  // Confirm a blog feed was displayed.
  $this
    ->drupalGet('blog/feed');
  $this
    ->assertTitle(t('Drupal blogs'), 'Blog feed was displayed');

  // Confirm a blog feed was displayed per user.
  $this
    ->drupalGet('blog/' . $user->uid . '/feed');
  $this
    ->assertTitle(t("@name's blog", array(
    '@name' => format_username($user),
  )), 'User blog feed was displayed');
}