ModerationStateViewsFieldUpdateTest.php in Drupal 8
File
core/modules/content_moderation/tests/src/Functional/Update/ModerationStateViewsFieldUpdateTest.php
View source
<?php
namespace Drupal\Tests\content_moderation\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
use Drupal\views\Entity\View;
class ModerationStateViewsFieldUpdateTest extends UpdatePathTestBase {
protected function setDatabaseDumpFiles() {
$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.5.0-content_moderation_installed.php',
];
}
public function testViewsFieldIdUpdate() {
$views_display = View::load('moderated_content')
->getDisplay('default');
$this
->assertEquals('field', $views_display['display_options']['fields']['moderation_state']['plugin_id']);
$this
->runUpdates();
$views_display = View::load('moderated_content')
->getDisplay('default');
$this
->assertEquals('moderation_state_field', $views_display['display_options']['fields']['moderation_state']['plugin_id']);
}
public function testViewsFieldIdUpdateWithoutViews() {
$this->container
->get('module_installer')
->uninstall([
'views',
]);
$this
->runUpdates();
}
}