protected function ContentModerationAccessTest::setUp in Access unpublished 8
Overrides BrowserTestBase::setUp
File
- tests/
src/ Functional/ ContentModerationAccessTest.php, line 46
Class
- ContentModerationAccessTest
- Tests the article creation.
Namespace
Drupal\Tests\access_unpublished\FunctionalCode
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',
]);
$workflow = $this
->createEditorialWorkflow();
$workflow
->getTypePlugin()
->addEntityTypeAndBundle('node', 'page');
$workflow
->save();
// Create an unpublished entity.
$this->entity = $this
->createNode();
$assert_session = $this
->assertSession();
// Verify that the entity is not accessible.
$this
->drupalGet($this->entity
->toUrl());
$assert_session
->statusCodeEquals(403);
}