public function testFormSaveDestination() { // Create new moderated content in draft.
$this->
drupalGet('node/add/moderated_content'
);
$this->
submitForm([ 'title[0][value]' => 'Some moderated content',
'body[0][value]' => 'First version of the content.',
'moderation_state[0][state]' => 'draft',
], 'Save'
);
$node =
$this->
drupalGetNodeByTitle('Some moderated content'
);
$edit_path =
sprintf('node/%d/edit',
$node->
id());
// After saving, we should be at the canonical URL and viewing the first
// revision.
$this->
assertSession()->
addressEquals(Url::
fromRoute('entity.node.canonical',
['node' =>
$node->
id()]));
$this->
assertSession()->
pageTextContains('First version of the content.'
);
// Create a new draft; after saving, we should still be on the canonical
// URL, but viewing the second revision.
$this->
drupalGet($edit_path);
$this->
submitForm([