DefaultModerationStateUpdateTest.php 1.18 KB
Newer Older
1
2
<?php

3
namespace Drupal\Tests\content_moderation\Functional\Update;
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

use Drupal\FunctionalTests\Update\UpdatePathTestBase;
use Drupal\workflows\Entity\Workflow;

/**
 * Tests the upgrade path for updating the 'default_moderation_state' setting.
 *
 * @group Update
 * @group legacy
 *
 * @see content_moderation_post_update_set_default_moderation_state()
 */
class DefaultModerationStateUpdateTest extends UpdatePathTestBase {

  /**
   * {@inheritdoc}
   */
  protected function setDatabaseDumpFiles() {
    $this->databaseDumpFiles = [
23
24
      __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.4.0.bare.standard.php.gz',
      __DIR__ . '/../../../fixtures/update/drupal-8.4.0-content_moderation_installed.php',
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
    ];
  }

  /**
   * Tests updating the default moderation state setting.
   */
  public function testUpdateDefaultModerationState() {
    $workflow = Workflow::load('editorial');
    $this->assertArrayNotHasKey('default_moderation_state', $workflow->getTypePlugin()->getConfiguration());

    $this->runUpdates();

    $workflow = Workflow::load('editorial');
    $this->assertEquals('draft', $workflow->getTypePlugin()->getConfiguration()['default_moderation_state']);
  }

}