Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / content_moderation / tests / src / Functional / DefaultContentModerationStateRevisionUpdateTest.php
index 6ec6b053be0c01c75d1175c1aded481ebfc53391..b84026dbe4fd787ebd74443500dfc2d7f6d62114 100644 (file)
@@ -9,6 +9,7 @@ use Drupal\FunctionalTests\Update\UpdatePathTestBase;
  * Test updating the ContentModerationState entity default revisions.
  *
  * @group Update
+ * @group legacy
  * @see content_moderation_post_update_update_cms_default_revisions
  */
 class DefaultContentModerationStateRevisionUpdateTest extends UpdatePathTestBase {
@@ -20,7 +21,6 @@ class DefaultContentModerationStateRevisionUpdateTest extends UpdatePathTestBase
     $this->databaseDumpFiles = [
       __DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.4.0.bare.standard.php.gz',
       __DIR__ . '/../../fixtures/update/drupal-8.4.0-content_moderation_installed.php',
-      __DIR__ . '/../../fixtures/update/drupal-8.default-cms-entity-id-2941736.php',
     ];
   }
 
@@ -28,6 +28,11 @@ class DefaultContentModerationStateRevisionUpdateTest extends UpdatePathTestBase
    * Test updating the default revision.
    */
   public function testUpdateDefaultRevision() {
+    // Include the database fixture required to test updating the default
+    // revision. This is excluded from  ::setDatabaseDumpFiles so that we can
+    // test the same post_update hook with no test content enabled.
+    require __DIR__ . '/../../fixtures/update/drupal-8.default-cms-entity-id-2941736.php';
+
     $this->runUpdates();
 
     foreach (['node', 'block_content'] as $entity_type_id) {
@@ -45,6 +50,14 @@ class DefaultContentModerationStateRevisionUpdateTest extends UpdatePathTestBase
     }
   }
 
+  /**
+   * Test the post_update hook when no entity types are being moderated.
+   */
+  public function testNoEntitiesUnderModeration() {
+    // If any errors occur during the post_update hook, the test case will fail.
+    $this->runUpdates();
+  }
+
   /**
    * Assert for the given entity, the default revision ID matches.
    *