ContentModerationStateIndexUpdatePathTest.php

Namespace

Drupal\Tests\content_moderation\Functional\Update

File

core/modules/content_moderation/tests/src/Functional/Update/ContentModerationStateIndexUpdatePathTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\content_moderation\Functional\Update;

use Drupal\Core\Database\Database;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;

/**
 * Tests the upgrade path for adding an index to moderation state column.
 *
 * @group content_moderation
 */
class ContentModerationStateIndexUpdatePathTest extends UpdatePathTestBase {
  
  /**
   * {@inheritdoc}
   */
  protected function setDatabaseDumpFiles() : void {
    $this->databaseDumpFiles = [
      __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-10.3.0.bare.standard.php.gz',
      __DIR__ . '/../../../fixtures/content-moderation.php',
    ];
  }
  
  /**
   * Tests the upgrade path for moderation state index.
   */
  public function testRunUpdates() : void {
    $table = 'content_moderation_state_field_revision';
    $name = 'content_moderation_state__moderation_state';
    $connection = Database::getConnection();
    $this->assertFalse($connection->schema()
      ->indexExists($table, $name));
    $this->runUpdates();
    $this->assertTrue($connection->schema()
      ->indexExists($table, $name));
  }

}

Classes

Title Deprecated Summary
ContentModerationStateIndexUpdatePathTest Tests the upgrade path for adding an index to moderation state column.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.