Loading config/schema/migrate_plus.process.schema.yml +0 −20 Changes for config/schema/migrate_plus.process.schema.yml: 0 added lines, 20 removed lines. Original line number Diff line number Diff line Loading @@ -20,26 +20,6 @@ migrate_plus.process.concat: type: string label: 'Delimiter' migrate_plus.process.dedupe_entity: type: migrate_process label: 'Dedupe Entity process' mapping: entity_type: type: string label: 'Entity type' field: type: string label: 'Field name' postfix: type: string label: 'Postfix' start: type: integer label: 'Start' length: type: integer label: 'Length' migrate_plus.process.explode: type: migrate_process label: 'Explode process' Loading migrate_example/config/install/migrate_plus.migration.beer_user.yml +2 −2 Changes for migrate_example/config/install/migrate_plus.migration.beer_user.yml: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -19,12 +19,12 @@ process: plugin: default_value default_value: 2 # Here's a new process plugin - dedupe_entity. Our source site allowed there # Here's a new process plugin - make_unique_entity_field. Our source site allowed there # to be multiple user accounts with the same username, but Drupal wants # usernames to be unique. This plugin allows us to automatically generate # unique usernames when we detect collisions. name: plugin: dedupe_entity plugin: make_unique_entity_field # The name of the source field containing the username. source: username # These next two settings identify the destination-side field to check for Loading migrate_example/migrate_example_setup/migrate_example_setup.install +4 −2 Changes for migrate_example/migrate_example_setup/migrate_example_setup.install: 4 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -367,8 +367,10 @@ function migrate_example_beer_data_node() { /** * Populate account table. * * Note that alice has duplicate username. Exercises dedupe_entity plugin. * TODO duplicate email also. * Note that alice has duplicate username. Exercises make_unique_entity_field * plugin. * * @todo Duplicate email also. */ function migrate_example_beer_data_account() { $fields = [ Loading migrate_example/tests/src/Kernel/MigrateExampleTest.php 0 → 100755 +73 −0 Changes for migrate_example/tests/src/Kernel/MigrateExampleTest.php: 73 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Drupal\Tests\migrate_example\Kernel; use Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase; /** * Tests migrate_example migrations. * * @group migrate_plus */ class MigrateExampleTest extends MigrateDrupalTestBase { /** * {@inheritdoc} */ protected static $modules = [ 'node', 'taxonomy', 'comment', 'text', 'migrate_plus', 'migrate_example', ]; /** * {@inheritdoc} */ protected function setUp(): void { parent::setUp(); $this->installConfig([ 'node', 'comment', 'migrate_example', ]); $this->installSchema('comment', ['comment_entity_statistics']); $this->installSchema('node', ['node_access']); // Install the module via installer to trigger hook_install. \Drupal::service('module_installer')->install(['migrate_example_setup']); $this->installConfig(['migrate_example_setup']); // Execute "beer" migrations from 'migrate_example' module. $this->executeMigrations([ 'beer_user', 'beer_term', 'beer_node', 'beer_comment', ]); } /** * Tests the results of "Beer" example migration. */ public function testBeerMigration() { $users = \Drupal::entityTypeManager()->getStorage('user')->loadMultiple(); // There are 4 users created in beer_user migration and 1 stub entity // created during beer_node migration. $this->assertCount(5, $users); $terms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadMultiple(); $this->assertCount(3, $terms); $nodes = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple(); $this->assertCount(3, $nodes); $comments = \Drupal::entityTypeManager()->getStorage('comment')->loadMultiple(); $this->assertCount(5, $comments); } } Loading
config/schema/migrate_plus.process.schema.yml +0 −20 Changes for config/schema/migrate_plus.process.schema.yml: 0 added lines, 20 removed lines. Original line number Diff line number Diff line Loading @@ -20,26 +20,6 @@ migrate_plus.process.concat: type: string label: 'Delimiter' migrate_plus.process.dedupe_entity: type: migrate_process label: 'Dedupe Entity process' mapping: entity_type: type: string label: 'Entity type' field: type: string label: 'Field name' postfix: type: string label: 'Postfix' start: type: integer label: 'Start' length: type: integer label: 'Length' migrate_plus.process.explode: type: migrate_process label: 'Explode process' Loading
migrate_example/config/install/migrate_plus.migration.beer_user.yml +2 −2 Changes for migrate_example/config/install/migrate_plus.migration.beer_user.yml: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -19,12 +19,12 @@ process: plugin: default_value default_value: 2 # Here's a new process plugin - dedupe_entity. Our source site allowed there # Here's a new process plugin - make_unique_entity_field. Our source site allowed there # to be multiple user accounts with the same username, but Drupal wants # usernames to be unique. This plugin allows us to automatically generate # unique usernames when we detect collisions. name: plugin: dedupe_entity plugin: make_unique_entity_field # The name of the source field containing the username. source: username # These next two settings identify the destination-side field to check for Loading
migrate_example/migrate_example_setup/migrate_example_setup.install +4 −2 Changes for migrate_example/migrate_example_setup/migrate_example_setup.install: 4 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -367,8 +367,10 @@ function migrate_example_beer_data_node() { /** * Populate account table. * * Note that alice has duplicate username. Exercises dedupe_entity plugin. * TODO duplicate email also. * Note that alice has duplicate username. Exercises make_unique_entity_field * plugin. * * @todo Duplicate email also. */ function migrate_example_beer_data_account() { $fields = [ Loading
migrate_example/tests/src/Kernel/MigrateExampleTest.php 0 → 100755 +73 −0 Changes for migrate_example/tests/src/Kernel/MigrateExampleTest.php: 73 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Drupal\Tests\migrate_example\Kernel; use Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase; /** * Tests migrate_example migrations. * * @group migrate_plus */ class MigrateExampleTest extends MigrateDrupalTestBase { /** * {@inheritdoc} */ protected static $modules = [ 'node', 'taxonomy', 'comment', 'text', 'migrate_plus', 'migrate_example', ]; /** * {@inheritdoc} */ protected function setUp(): void { parent::setUp(); $this->installConfig([ 'node', 'comment', 'migrate_example', ]); $this->installSchema('comment', ['comment_entity_statistics']); $this->installSchema('node', ['node_access']); // Install the module via installer to trigger hook_install. \Drupal::service('module_installer')->install(['migrate_example_setup']); $this->installConfig(['migrate_example_setup']); // Execute "beer" migrations from 'migrate_example' module. $this->executeMigrations([ 'beer_user', 'beer_term', 'beer_node', 'beer_comment', ]); } /** * Tests the results of "Beer" example migration. */ public function testBeerMigration() { $users = \Drupal::entityTypeManager()->getStorage('user')->loadMultiple(); // There are 4 users created in beer_user migration and 1 stub entity // created during beer_node migration. $this->assertCount(5, $users); $terms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadMultiple(); $this->assertCount(3, $terms); $nodes = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple(); $this->assertCount(3, $nodes); $comments = \Drupal::entityTypeManager()->getStorage('comment')->loadMultiple(); $this->assertCount(5, $comments); } }