function ModerationStateNodeTest::testNoContentModerationPermissions
Same name in other branches
- 9 core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTest.php \Drupal\Tests\content_moderation\Functional\ModerationStateNodeTest::testNoContentModerationPermissions()
- 8.9.x core/modules/content_moderation/tests/src/Functional/ModerationStateNodeTest.php \Drupal\Tests\content_moderation\Functional\ModerationStateNodeTest::testNoContentModerationPermissions()
- 10 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 162
Class
- ModerationStateNodeTest
- Tests general content moderation workflow for nodes.
Namespace
Drupal\Tests\content_moderation\FunctionalCode
public function testNoContentModerationPermissions() : void {
$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->submitForm([
'title[0][value]' => 'moderated content',
], 'Save');
$session_assert->pageTextContains('You do not have access to transition from Draft to Draft');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.