diff --git a/CHANGELOG.md b/CHANGELOG.md index bf6136e..ee2d229 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ # Stanford Migrate +8.x-2.0 +-------------------------------------------------------------------------------- +_Release Date: 2022-05-02_ + +- Updated contrib modules and patch (#56) +- Lock migrate_plus to 5.2 (#55) + + 8.x-1.24 -------------------------------------------------------------------------------- _Release Date: 2022-04-05_ diff --git a/composer.json b/composer.json index f639745..8c66c38 100755 --- a/composer.json +++ b/composer.json @@ -15,9 +15,9 @@ ], "require": { "drupal/migrate_file": "^2.0", - "drupal/migrate_plus": "^5.0", + "drupal/migrate_plus": "^6.0", "drupal/migrate_source_csv": "^3.4", - "drupal/migrate_tools": "^5.0", + "drupal/migrate_tools": "^6.0", "drupal/readonly_field_widget": "^1.4", "drupal/ultimate_cron": "^2.0@alpha", "joshfraser/php-name-parser": "dev-master" @@ -29,7 +29,7 @@ "patches": { "drupal/migrate_plus": { "https://www.drupal.org/project/migrate_plus/issues/2837684": "https://www.drupal.org/files/issues/2837684-8-migrate-plus-xml-return-as-xml.patch", - "https://www.drupal.org/project/migrate_plus/issues/3050058": "https://www.drupal.org/files/issues/2022-01-03/3050058-9-item-selector-missing.patch" + "https://www.drupal.org/project/migrate_plus/issues/3050058": "https://git.drupalcode.org/project/migrate_plus/-/merge_requests/59.patch" } } }, diff --git a/src/StanfordMigrateBatchExecutable.php b/src/StanfordMigrateBatchExecutable.php index f14bd29..07cd70e 100644 --- a/src/StanfordMigrateBatchExecutable.php +++ b/src/StanfordMigrateBatchExecutable.php @@ -19,7 +19,7 @@ class StanfordMigrateBatchExecutable extends MigrateBatchExecutable { /** * {@inheritdoc} */ - public function batchImport() { + public function batchImport(): void { // Create the batch operations for each migration that needs to be executed. // This includes the migration for this executable, but also the dependent // migrations. @@ -46,7 +46,7 @@ public function batchImport() { /** * {@inheritdoc} */ - protected function batchOperations(array $migrations, $operation, array $options = []) { + protected function batchOperations(array $migrations, $operation, array $options = []): array { array_walk($migrations, [$this, 'prepareMigrations']); $operations = parent::batchOperations($migrations, $operation, $options); foreach ($operations as &$operation) { @@ -77,7 +77,7 @@ protected function prepareMigrations(MigrationInterface $migration) { /** * {@inheritdoc} */ - public static function batchProcessImport($migration_id, array $options, &$context) { + public static function batchProcessImport($migration_id, array $options, &$context): void { if (empty($context['sandbox'])) { $context['finished'] = 0; $context['sandbox'] = []; diff --git a/stanford_migrate.info.yml b/stanford_migrate.info.yml index d2dbffe..79b52e6 100755 --- a/stanford_migrate.info.yml +++ b/stanford_migrate.info.yml @@ -3,7 +3,7 @@ description: 'Adds more functionality to migrate and migrate plus modules' type: module core_version_requirement: ^8.8 || ^9 || ^10 package: 'Stanford' -version: 8.x-1.24 +version: 8.x-2.0 dependencies: - drupal:migrate - migrate_plus:migrate_plus diff --git a/tests/src/Unit/Plugin/migrate/process/EntityGenerateNoLookupTest.php b/tests/src/Unit/Plugin/migrate/process/EntityGenerateNoLookupTest.php index 6468cac..1caf103 100644 --- a/tests/src/Unit/Plugin/migrate/process/EntityGenerateNoLookupTest.php +++ b/tests/src/Unit/Plugin/migrate/process/EntityGenerateNoLookupTest.php @@ -7,6 +7,7 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManagerInterface; use Drupal\Core\Entity\EntityStorageInterface; +use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\stanford_migrate\Plugin\migrate\process\EntityGenerateNoLookup; use Drupal\migrate\MigrateExecutable; @@ -37,9 +38,14 @@ public function testTranform() { $entity_storage->method('create') ->willReturn($entity); + $entity_definition = $this->createMock(EntityTypeInterface::class); + $entity_definition->method('getKey')->willReturn('foo'); + $entity_type_manager = $this->createMock(EntityTypeManagerInterface::class); $entity_type_manager->method('getStorage') ->willReturn($entity_storage); + $entity_type_manager->method('getDefinition') + ->willReturn($entity_definition); $field_manager = $this->createMock(EntityFieldManagerInterface::class); @@ -48,9 +54,11 @@ public function testTranform() { $container->set('plugin.manager.entity_reference_selection', $this->createMock(SelectionPluginManagerInterface::class)); $container->set('plugin.manager.migrate.process', $this->createMock(MigratePluginManager::class)); + $destination_plugin = $this->createMock(MigrateDestinationInterface::class); + $destination_plugin->method('getPluginId')->willReturn('foo:bar'); $migration = $this->createMock(MigrationInterface::class); $migration->method('getDestinationPlugin') - ->willReturn($this->createMock(MigrateDestinationInterface::class)); + ->willReturn($destination_plugin); $configuration = [ 'entity_type' => 'type', 'value_key' => 'key', diff --git a/tests/src/Unit/Plugin/migrate/process/EntityRevisionGenerateTest.php b/tests/src/Unit/Plugin/migrate/process/EntityRevisionGenerateTest.php index f5d986e..e3583cb 100644 --- a/tests/src/Unit/Plugin/migrate/process/EntityRevisionGenerateTest.php +++ b/tests/src/Unit/Plugin/migrate/process/EntityRevisionGenerateTest.php @@ -6,6 +6,7 @@ use Drupal\Core\Entity\EntityFieldManagerInterface; use Drupal\Core\Entity\EntityReferenceSelection\SelectionPluginManagerInterface; use Drupal\Core\Entity\EntityStorageInterface; +use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\RevisionableInterface; use Drupal\stanford_migrate\Plugin\migrate\process\EntityGenerateNoLookup; @@ -40,9 +41,14 @@ public function testTranform() { ->willReturn($entity); $entity_storage->method('load')->willReturn($entity); + $entity_definition = $this->createMock(EntityTypeInterface::class); + $entity_definition->method('getKey')->willReturn('foo'); + $entity_type_manager = $this->createMock(EntityTypeManagerInterface::class); $entity_type_manager->method('getStorage') ->willReturn($entity_storage); + $entity_type_manager->method('getDefinition') + ->willReturn($entity_definition); $field_manager = $this->createMock(EntityFieldManagerInterface::class); @@ -51,9 +57,12 @@ public function testTranform() { $container->set('plugin.manager.entity_reference_selection', $this->createMock(SelectionPluginManagerInterface::class)); $container->set('plugin.manager.migrate.process', $this->createMock(MigratePluginManager::class)); + $destination_plugin = $this->createMock(MigrateDestinationInterface::class); + $destination_plugin->method('getPluginId')->willReturn('foo:bar'); + $migration = $this->createMock(MigrationInterface::class); $migration->method('getDestinationPlugin') - ->willReturn($this->createMock(MigrateDestinationInterface::class)); + ->willReturn($destination_plugin); $configuration = [ 'entity_type' => 'type', 'value_key' => 'key',