diff --git a/composer.json b/composer.json index 8f8d7b1ce02040a95e92039c9b8b4237755033fe..1caa8706b71caea761f9c3bc6f8aa94ad414d3f5 100644 --- a/composer.json +++ b/composer.json @@ -7,25 +7,13 @@ "drupal/autosave_form": "^1.2", "drupal/conflict": "^2.0-alpha2", "drupal/diff": "^1.0", - "drupal/lightning_core": "3.* || 4.* || 5.*", + "drupal/lightning_core": "^5", "drupal/moderation_dashboard": "^1.0", "drupal/moderation_sidebar": "^1.2" }, - "extra": { - "branch-alias": { - "dev-8.x-3.x": "3.x-dev" - } - }, - "repositories": { - "drupal": { - "type": "composer", - "url": "https://packages.drupal.org/8" - } - }, - "minimum-stability": "dev", - "prefer-stable": true, "require-dev": { - "drush/drush": "^10", - "drupal/inline_entity_form": "^1" + "drush/drush": "^10 || ^11", + "drupal/inline_entity_form": "^1", + "drupal/quickedit": "^1" } } diff --git a/lightning_workflow.info.yml b/lightning_workflow.info.yml index c24ba8d8532b668449a9ef93cfcc9e9bf53de807..2809a50ea083710c617ddd82f99b026d048081f6 100644 --- a/lightning_workflow.info.yml +++ b/lightning_workflow.info.yml @@ -1,10 +1,8 @@ name: 'Lightning Workflow' -core_version_requirement: '^9.0.6' +core_version_requirement: '^9.0.6 || ^10' type: module description: 'Tools to improve your content workflow.' package: Lightning dependencies: - drupal:content_moderation - lightning_core:lightning_core -components: - - lightning_scheduler diff --git a/modules/lightning_scheduler/lightning_scheduler.info.yml b/modules/lightning_scheduler/lightning_scheduler.info.yml index c0fd931d75e86d290985fa45df08dd9e74da4906..c06dc911b56d5f214504081d92c382048cccf6fb 100644 --- a/modules/lightning_scheduler/lightning_scheduler.info.yml +++ b/modules/lightning_scheduler/lightning_scheduler.info.yml @@ -1,5 +1,5 @@ name: Scheduler -core_version_requirement: '^9.0.6' +core_version_requirement: '^9.0.6 || ^10' type: module description: 'Allows you to schedule changes in moderation state.' package: Lightning diff --git a/modules/lightning_scheduler/tests/fixtures/BaseFieldMigrationTest.php.gz b/modules/lightning_scheduler/tests/fixtures/BaseFieldMigrationTest.php.gz index 5a7a43d14a274346f6d4a0baa9c0808dc7e156e6..24f2f1fffe22484b3d1bf24fca0d4435f6cf77c5 100644 Binary files a/modules/lightning_scheduler/tests/fixtures/BaseFieldMigrationTest.php.gz and b/modules/lightning_scheduler/tests/fixtures/BaseFieldMigrationTest.php.gz differ diff --git a/modules/lightning_scheduler/tests/src/Functional/MigrationTestBase.php b/modules/lightning_scheduler/tests/src/Functional/MigrationTestBase.php index 42d2f0aad49331086a637c18f7af351cb734f2d7..50faf36154a1430ff5ba78048f1cae7ee6d26218 100644 --- a/modules/lightning_scheduler/tests/src/Functional/MigrationTestBase.php +++ b/modules/lightning_scheduler/tests/src/Functional/MigrationTestBase.php @@ -18,19 +18,32 @@ abstract class MigrationTestBase extends UpdatePathTestBase { * {@inheritdoc} */ protected function setDatabaseDumpFiles() { - $this->databaseDumpFiles = []; - - $fixture = $this->getDrupalRoot() . '/core/modules/system/tests/fixtures/update/drupal-8.8.0.bare.standard.php.gz'; - - // If we're on Drupal 8.8 or later, use its base fixture. Otherwise, use the - // older 8.4 base fixture included with versions of core before 8.8. - if (file_exists($fixture)) { - $this->databaseDumpFiles[] = $fixture; + if (str_starts_with(\Drupal::VERSION, '10.')) { + $core_fixture = 'drupal-9.4.0.bare.standard.php.gz'; } else { - $this->databaseDumpFiles[] = str_replace('8.8.0', '8.4.0', $fixture); + $core_fixture = 'drupal-8.8.0.bare.standard.php.gz'; } - $this->databaseDumpFiles[] = __DIR__ . '/../../fixtures/BaseFieldMigrationTest.php.gz'; + $this->databaseDumpFiles = [ + $this->getDrupalRoot() . '/core/modules/system/tests/fixtures/update/' . $core_fixture, + __DIR__ . '/../../fixtures/BaseFieldMigrationTest.php.gz', + ]; + } + + /** + * {@inheritdoc} + */ + protected function setUp(): void { + parent::setUp(); + + /** @var \Drupal\Core\Entity\EntityFieldManagerInterface $field_manager */ + $base_fields = $this->container->get('entity_field.manager') + ->getBaseFieldDefinitions('content_moderation_state'); + + /** @var \Drupal\Core\Entity\EntityDefinitionUpdateManagerInterface $updater */ + $updater = $this->container->get('entity.definition_update_manager'); + $updater->updateFieldStorageDefinition($base_fields['id']); + $updater->updateFieldStorageDefinition($base_fields['revision_id']); } /** diff --git a/modules/lightning_scheduler/tests/src/Kernel/Update/Update8003Test.php b/modules/lightning_scheduler/tests/src/Kernel/Update/Update8003Test.php index 91dee8e097cd3d572d3659d3122546dc9883197f..3b0ca283f572dfd58eaa66eb2fa9205e062300c5 100644 --- a/modules/lightning_scheduler/tests/src/Kernel/Update/Update8003Test.php +++ b/modules/lightning_scheduler/tests/src/Kernel/Update/Update8003Test.php @@ -20,25 +20,19 @@ class Update8003Test extends KernelTestBase { ]; /** - * Tests that the config object is created. + * Tests that the config object is cresated. */ public function testUpdate() { - /** @var \Drupal\Core\Config\ConfigFactoryInterface $config_factory */ - $config_factory = $this->container->get('config.factory'); - // Assert the config object does not already exist. - $is_new = $config_factory - ->getEditable('lightning_scheduler.settings') - ->isNew(); - $this->assertTrue($is_new); + $this->assertTrue($this->config('lightning_scheduler.settings')->isNew()); // Run the update. - module_load_install('lightning_scheduler'); + $this->container->get('module_handler') + ->loadInclude('lightning_scheduler', 'install'); lightning_scheduler_update_8003(); // Assert the config object was created. - $time_step = $config_factory - ->get('lightning_scheduler.settings') + $time_step = $this->config('lightning_scheduler.settings') ->get('time_step'); $this->assertSame(60, $time_step); } diff --git a/tests/fixtures/Update8006Test.php.gz b/tests/fixtures/Update8006Test.php.gz index b2fa1b74d3d4c8352469c2fa9c23804f8c61cf2f..15db284328c96fca949944c614c4925bd193c404 100644 Binary files a/tests/fixtures/Update8006Test.php.gz and b/tests/fixtures/Update8006Test.php.gz differ diff --git a/tests/fixtures/drupal-9.4.0-update-from-1.0.0-rc2.php.gz b/tests/fixtures/drupal-9.4.0-update-from-1.0.0-rc2.php.gz new file mode 100644 index 0000000000000000000000000000000000000000..7be456f33654004e0ebf25b8f56d09875c8abbe5 Binary files /dev/null and b/tests/fixtures/drupal-9.4.0-update-from-1.0.0-rc2.php.gz differ diff --git a/tests/src/Functional/Update8006Test.php b/tests/src/Functional/Update8006Test.php index ac9352091100ed92f434d9948168d2375143026f..1f93c467a6a385f4a368d8fce13f2d88e1dc8b6f 100644 --- a/tests/src/Functional/Update8006Test.php +++ b/tests/src/Functional/Update8006Test.php @@ -16,12 +16,34 @@ class Update8006Test extends UpdatePathTestBase { * {@inheritdoc} */ protected function setDatabaseDumpFiles() { + if (str_starts_with(\Drupal::VERSION, '10.')) { + $core_fixture = 'drupal-9.4.0.bare.standard.php.gz'; + } + else { + $core_fixture = 'drupal-8.8.0.bare.standard.php.gz'; + } $this->databaseDumpFiles = [ - $this->getDrupalRoot() . '/core/modules/system/tests/fixtures/update/drupal-8.8.0.bare.standard.php.gz', + $this->getDrupalRoot() . '/core/modules/system/tests/fixtures/update/' . $core_fixture, __DIR__ . '/../../fixtures/Update8006Test.php.gz', ]; } + /** + * {@inheritdoc} + */ + protected function setUp(): void { + parent::setUp(); + + /** @var \Drupal\Core\Entity\EntityFieldManagerInterface $field_manager */ + $base_fields = $this->container->get('entity_field.manager') + ->getBaseFieldDefinitions('content_moderation_state'); + + /** @var \Drupal\Core\Entity\EntityDefinitionUpdateManagerInterface $updater */ + $updater = $this->container->get('entity.definition_update_manager'); + $updater->updateFieldStorageDefinition($base_fields['id']); + $updater->updateFieldStorageDefinition($base_fields['revision_id']); + } + /** * Tests lightning_workflow_update_8006(). */ diff --git a/tests/src/Functional/UpdatePathTest.php b/tests/src/Functional/UpdatePathTest.php index 965447e3d690f73e0f649c7bbf3b18f915249cca..b830ecb32c43d0570f4427756dd7c03ba3c61fbd 100644 --- a/tests/src/Functional/UpdatePathTest.php +++ b/tests/src/Functional/UpdatePathTest.php @@ -20,9 +20,13 @@ class UpdatePathTest extends UpdatePathTestBase { * {@inheritdoc} */ protected function setDatabaseDumpFiles() { - $this->databaseDumpFiles = [ - __DIR__ . '/../../fixtures/drupal-8.8.0-update-from-1.0.0-rc2.php.gz', - ]; + if (str_starts_with(\Drupal::VERSION, '10.')) { + $fixture = __DIR__ . '/../../fixtures/drupal-9.4.0-update-from-1.0.0-rc2.php.gz'; + } + else { + $fixture = __DIR__ . '/../../fixtures/drupal-8.8.0-update-from-1.0.0-rc2.php.gz'; + } + $this->databaseDumpFiles = [$fixture]; } /**