BasicBlogTest.php in Blog 8.2
File
tests/src/Functional/BasicBlogTest.php
View source
<?php
namespace Drupal\Tests\blog\Functional;
use Drupal\Tests\block\Functional\AssertBlockAppearsTrait;
class BasicBlogTest extends BlogTestBase {
use AssertBlockAppearsTrait;
protected $defaultTheme = 'stark';
protected static $modules = [
'block',
'blog',
];
protected $regularUser;
protected function setUp() : void {
parent::setUp();
$this->regularUser = $this
->drupalCreateUser([
'create article content',
]);
}
public function testPersonalBlogTitle() {
$this
->drupalLogin($this->regularUser);
$this
->drupalGet('blog/' . $this->blogger1
->id());
$this
->assertResponse(200);
$this
->assertTitle($this->blogger1
->getDisplayName() . "'s blog | Drupal");
}
public function testBlogPageNoEntries() {
$this
->drupalLogin($this->regularUser);
$this
->drupalGet('blog/' . $this->bloggerNoEntries
->id());
$this
->assertResponse(200);
$this
->assertTitle($this->bloggerNoEntries
->getDisplayName() . "'s blog | Drupal");
$this
->assertText($this->bloggerNoEntries
->getDisplayName() . ' has not created any blog entries.');
}
public function testBlogBlock() {
$blog_block = $this
->drupalPlaceBlock('blog_blockblock-views-block-blog-blog-block');
$this
->drupalGet('<front>');
$this
->assertBlockAppears($blog_block);
}
}