public function ModerationStateNodeTest::testNoContentModerationPermissions in Drupal 8
Same name and namespace in other branches
- 9 core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTest.php \Drupal\Tests\content_moderation\Functional\ModerationStateNodeTest::testNoContentModerationPermissions()
Tests the workflow when a user has no Content Moderation permissions.
File
- core/
modules/ content_moderation/ tests/ src/ Functional/ ModerationStateNodeTest.php, line 155
Class
- ModerationStateNodeTest
- Tests general content moderation workflow for nodes.
Namespace
Drupal\Tests\content_moderation\FunctionalCode
public function testNoContentModerationPermissions() {
$session_assert = $this
->assertSession();
// Create a user with quite advanced node permissions but no content
// moderation permissions.
$limited_user = $this
->createUser([
'administer nodes',
'bypass node access',
]);
$this
->drupalLogin($limited_user);
// Check the user can see the content entity form, but can't see the
// moderation state select or save the entity form.
$this
->drupalGet('node/add/moderated_content');
$session_assert
->statusCodeEquals(200);
$session_assert
->fieldNotExists('moderation_state[0][state]');
$this
->drupalPostForm(NULL, [
'title[0][value]' => 'moderated content',
], 'Save');
$session_assert
->pageTextContains('You do not have access to transition from Draft to Draft');
}