protected function AccessUnpublishedTest::setUp in Access unpublished 8
Overrides BrowserTestBase::setUp
File
- tests/
src/ FunctionalJavascript/ AccessUnpublishedTest.php, line 59
Class
- AccessUnpublishedTest
- Test for access unpublished integration.
Namespace
Drupal\Tests\access_unpublished\FunctionalJavascriptCode
protected function setUp() {
parent::setUp();
NodeType::create([
'type' => 'page',
'name' => 'page',
])
->save();
user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, [
'access content',
'access_unpublished node page',
]);
// Create an unpublished entity.
$this->entity = $this
->createNode([
'status' => FALSE,
]);
$assert_session = $this
->assertSession();
// Verify that the entity is not accessible.
$this
->drupalGet($this->entity
->toUrl());
$assert_session
->pageTextContains('Access denied');
$account = $this
->drupalCreateUser(static::$userPermissions);
$this
->drupalLogin($account);
}