diff --git a/src/Tests/DiffRevisionTest.php b/src/Tests/DiffRevisionTest.php index c43f214..e594d09 100644 --- a/src/Tests/DiffRevisionTest.php +++ b/src/Tests/DiffRevisionTest.php @@ -284,10 +284,18 @@ class DiffRevisionTest extends DiffTestBase { $this->clickLink('Set as current revision'); $this->drupalPostForm(NULL, [], t('Revert')); - // Check the last revision is set as current. - $text = $this->xpath('//tbody/tr[1]/td[4]/em'); - $this->assertEqual($text[0], 'Current revision'); - $this->assertNoLink(t('Set as current revision')); + if (\Drupal::moduleHandler()->moduleExists('content_moderation')) { + // With content moderation, the new revision will not be current. + // @see https://www.drupal.org/node/2899719 + $text = $this->xpath('//tbody/tr[1]/td[4]/div/div/ul/li/a'); + $this->assertEqual($text[0], 'Set as current revision'); + } + else { + // Check the last revision is set as current. + $text = $this->xpath('//tbody/tr[1]/td[4]/em'); + $this->assertEqual($text[0], 'Current revision'); + $this->assertNoLink(t('Set as current revision')); + } } /** @@ -445,6 +453,9 @@ class DiffRevisionTest extends DiffTestBase { 'title[0][value]' => $title, 'body[0][value]' => '

First article

', ]; + if (\Drupal::moduleHandler()->moduleExists('content_moderation')) { + $edit['moderation_state[0][state]'] = 'published'; + } $this->drupalPostNodeForm('node/add/article', $edit, t('Save and publish')); $node_one = $this->drupalGetNodeByTitle($title); @@ -454,6 +465,9 @@ class DiffRevisionTest extends DiffTestBase { 'title[0][value]' => $title, 'body[0][value]' => '

Second article

', ]; + if (\Drupal::moduleHandler()->moduleExists('content_moderation')) { + $edit['moderation_state[0][state]'] = 'published'; + } $this->drupalPostNodeForm('node/add/article', $edit, t('Save and publish')); $node_two = $this->drupalGetNodeByTitle($title); @@ -463,6 +477,9 @@ class DiffRevisionTest extends DiffTestBase { 'field_content[0][target_id]' => $node_two->getTitle(), 'revision' => TRUE, ]; + if (\Drupal::moduleHandler()->moduleExists('content_moderation')) { + $edit['moderation_state[0][state]'] = 'published'; + } $this->drupalPostNodeForm('node/' . $node_one->id() . '/edit', $edit, t('Save and keep published')); // Delete referenced node.