MyBlogLinkTest.php in Blog 8.2
File
tests/src/Functional/MyBlogLinkTest.php
View source
<?php
namespace Drupal\Tests\blog\Functional;
class MyBlogLinkTest extends BlogTestBase {
protected $defaultTheme = 'stark';
protected static $modules = [
'block',
'blog',
'field_ui',
];
protected $regularUser;
protected function setUp() : void {
parent::setUp();
$this->regularUser = $this
->drupalCreateUser([
'create article content',
'administer user display',
]);
$this
->placeBlock('system_menu_block:account', [
'region' => 'content',
]);
}
public function testMyBlogLinkWithRegularUser() {
$this
->drupalLogin($this->regularUser);
$this
->assertLink('My blog');
$this
->assertLinkByHref('/blog/' . $this->regularUser
->id());
}
public function testMyBlogLinkWithAnonUser() {
$this
->assertNoLink('My blog');
}
public function testPersonalBlogLinkWithManageDisplayPage() {
$this
->drupalLogin($this->regularUser);
$this
->drupalGet('admin/config/people/accounts/display');
$this
->assertText('Personal blog link');
}
public function testPersonalBlogLink() {
$this
->drupalLogin($this->blogger1);
$this
->drupalGet('user/' . $this->blogger1
->id());
$this
->assertLink('View recent blog entries');
$this
->assertLinkByHref('/blog/' . $this->blogger1
->id());
}
}
Classes
Name |
Description |
MyBlogLinkTest |
Link "My blog" and "View recent blog entries" test for blog module. |