public function testNodePathAlias() { // Create some moderated content with a path alias.
$this->
drupalGet('node/add/moderated'
);
$this->
assertSession()->
fieldValueEquals('path[0][alias]', ''
);
$this->
submitForm([ 'title[0][value]' => 'moderated content',
'path[0][alias]' => '/moderated-content',
'moderation_state[0][state]' => 'published',
], 'Save'
);
$node =
$this->
getNodeByTitle('moderated content'
);
// Add a pending revision with the same alias.
$this->
drupalGet('node/' .
$node->
id() . '/edit'
);
$this->
assertSession()->
fieldValueEquals('path[0][alias]', '/moderated-content'
);
$this->
submitForm([ 'title[0][value]' => 'pending revision',
'path[0][alias]' => '/moderated-content',
'moderation_state[0][state]' => 'draft',
], 'Save'
);
$this->
assertSession()->
statusMessageNotContains('You can only change the URL alias for the published version of this content.'
);