Commit d1227108 authored by catch's avatar catch

Issue #2910715 by Sam152: The assertions in ModerationFormTest::testWorkflowInUse are inadequate

parent cf553a00
...@@ -483,6 +483,10 @@ public function testWorkflowInUse() { ...@@ -483,6 +483,10 @@ public function testWorkflowInUse() {
'archived_state' => 'admin/config/workflow/workflows/manage/editorial/state/archived/delete', 'archived_state' => 'admin/config/workflow/workflows/manage/editorial/state/archived/delete',
'editorial_workflow' => 'admin/config/workflow/workflows/manage/editorial/delete', 'editorial_workflow' => 'admin/config/workflow/workflows/manage/editorial/delete',
]; ];
$messages = [
'archived_state' => 'This workflow state is in use. You cannot remove this workflow state until you have removed all content using it.',
'editorial_workflow' => 'This workflow is in use. You cannot remove this workflow until you have removed all content using it.',
];
foreach ($paths as $path) { foreach ($paths as $path) {
$this->drupalGet($path); $this->drupalGet($path);
$this->assertSession()->buttonExists('Delete'); $this->assertSession()->buttonExists('Delete');
...@@ -501,6 +505,8 @@ public function testWorkflowInUse() { ...@@ -501,6 +505,8 @@ public function testWorkflowInUse() {
// The workflow is being used, so can't be deleted. // The workflow is being used, so can't be deleted.
$this->drupalGet($paths['editorial_workflow']); $this->drupalGet($paths['editorial_workflow']);
$this->assertSession()->buttonNotExists('Delete'); $this->assertSession()->buttonNotExists('Delete');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextContains($messages['editorial_workflow']);
$node = $this->drupalGetNodeByTitle('Some moderated content'); $node = $this->drupalGetNodeByTitle('Some moderated content');
$this->drupalPostForm('node/' . $node->id() . '/edit', [ $this->drupalPostForm('node/' . $node->id() . '/edit', [
...@@ -511,9 +517,11 @@ public function testWorkflowInUse() { ...@@ -511,9 +517,11 @@ public function testWorkflowInUse() {
], 'Save'); ], 'Save');
// Now the archived state is being used so it can not be deleted either. // Now the archived state is being used so it can not be deleted either.
foreach ($paths as $path) { foreach ($paths as $type => $path) {
$this->drupalGet($path); $this->drupalGet($path);
$this->assertSession()->buttonNotExists('Delete'); $this->assertSession()->buttonNotExists('Delete');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->pageTextContains($messages[$type]);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment