public function ModerationFormTest::testModerationFormSetsRevisionAuthor in Workbench Moderation 8
Tests the revision author is updated when the moderation form is used.
File
- tests/
src/ Functional/ ModerationFormTest.php, line 127
Class
- ModerationFormTest
- Tests the moderation form, specifically on nodes.
Namespace
Drupal\Tests\workbench_moderation\FunctionalCode
public function testModerationFormSetsRevisionAuthor() {
// Create new moderated content in published.
$node = $this
->createNode([
'type' => 'moderated_content',
'moderation_state' => 'published',
]);
// Make a forward revision.
$node->moderation_state->target_id = 'draft';
$node
->save();
$another_user = $this
->drupalCreateUser($this->permissions);
$this
->grantUserPermissionToCreateContentOfType($another_user, 'moderated_content');
$this
->drupalLogin($another_user);
$this
->drupalPostForm(sprintf('node/%d/latest', $node
->id()), [
'new_state' => 'needs_review',
], t('Apply'));
$this
->drupalGet(sprintf('node/%d/revisions', $node
->id()));
$this
->assertSession()
->pageTextContains('by ' . $another_user
->getAccountName());
}