Skip to content
Snippets Groups Projects
Commit ab5c9f50 authored by Adam G-H's avatar Adam G-H
Browse files

Issue #3323215 by phenaproxima: Get tests passing on Drupal 10

parent 560884cf
No related branches found
No related tags found
1 merge request!5Issue #3323215: Get tests passing on Drupal 10
......@@ -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"
}
}
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
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
......
No preview for this file type
......@@ -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']);
}
/**
......
......@@ -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);
}
......
No preview for this file type
File added
......@@ -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().
*/
......
......@@ -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];
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment