You are here

public function MyBlogLinkTest::testPersonalBlogLinkWithManageDisplayPage in Blog 3.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/MyBlogLinkTest.php \Drupal\Tests\blog\Functional\MyBlogLinkTest::testPersonalBlogLinkWithManageDisplayPage()

Test "Personal blog link" entry.

File

tests/src/Functional/MyBlogLinkTest.php, line 61

Class

MyBlogLinkTest
Link "My blog" and "View recent blog entries" test for blog module.

Namespace

Drupal\Tests\blog\Functional

Code

public function testPersonalBlogLinkWithManageDisplayPage() {
  $this
    ->drupalLogin($this->regularUser);

  // Add "Personal blog link" psuedo-field.
  $this
    ->drupalGet('admin/config/people/accounts/display');
  $this
    ->assertText('Personal blog link');
  $edit = [
    'fields[blog__personal_blog_link][region]' => 'content',
    'display_modes_custom[compact]' => TRUE,
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Save');
  $this
    ->drupalLogout();

  // Test "Personal blog link" on user profile page.
  $this
    ->drupalLogin($this->blogger1);
  $this
    ->drupalGet('user/' . $this->blogger1
    ->id());
  $this
    ->assertLink('View recent blog entries');
  $this
    ->assertLinkByHref('blog/' . $this->blogger1
    ->id());

  // Test "Personal blog link" on content.
  $node = array_shift($this->blogNodes1);
  $this
    ->drupalGet('node/' . $node
    ->id());
  $this
    ->assertNoLink('View recent blog entries');
}