Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / content_translation / tests / src / Functional / ContentTranslationPendingRevisionTestBase.php
index 3a3a058962a5876ed7ce75df077da52450c01f35..ef0f54aeca44dd8b94130b4c9ccbb7fd780bd80a 100644 (file)
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\content_translation\Functional;
 
 use Drupal\Core\Entity\ContentEntityInterface;
+use Drupal\Tests\content_moderation\Traits\ContentModerationTestTrait;
 use Drupal\Tests\node\Traits\ContentTypeCreationTrait;
 
 /**
@@ -11,6 +12,7 @@ use Drupal\Tests\node\Traits\ContentTypeCreationTrait;
 abstract class ContentTranslationPendingRevisionTestBase extends ContentTranslationTestBase {
 
   use ContentTypeCreationTrait;
+  use ContentModerationTestTrait;
 
   /**
    * {@inheritdoc}
@@ -110,6 +112,7 @@ abstract class ContentTranslationPendingRevisionTestBase extends ContentTranslat
   protected function setupBundle() {
     parent::setupBundle();
     $this->createContentType(['type' => $this->bundle]);
+    $this->createEditorialWorkflow();
   }
 
   /**
@@ -124,6 +127,9 @@ abstract class ContentTranslationPendingRevisionTestBase extends ContentTranslat
    *   The active revision translation or NULL if none could be identified.
    */
   protected function loadRevisionTranslation(ContentEntityInterface $entity, $langcode) {
+    // Explicitly invalidate the cache for that node, as the call below is
+    // statically cached.
+    $this->storage->resetCache([$entity->id()]);
     $revision_id = $this->storage->getLatestTranslationAffectedRevisionId($entity->id(), $langcode);
     /** @var \Drupal\Core\Entity\ContentEntityInterface $revision */
     $revision = $revision_id ? $this->storage->loadRevision($revision_id) : NULL;