You are here

public function ProfileDeriverTest::testProfileMigrations in Commerce Migrate 8.2

Same name and namespace in other branches
  1. 3.1.x modules/commerce/tests/src/Kernel/Migrate/commerce1/ProfileDeriverTest.php \Drupal\Tests\commerce_migrate_commerce\Kernel\Migrate\commerce1\ProfileDeriverTest::testProfileMigrations()
  2. 3.0.x modules/commerce/tests/src/Kernel/Migrate/commerce1/ProfileDeriverTest.php \Drupal\Tests\commerce_migrate_commerce\Kernel\Migrate\commerce1\ProfileDeriverTest::testProfileMigrations()

Test product variation migrations.

File

modules/commerce/tests/src/Kernel/Migrate/commerce1/ProfileDeriverTest.php, line 36

Class

ProfileDeriverTest
Tests profile deriver.

Namespace

Drupal\Tests\commerce_migrate_commerce\Kernel\Migrate\commerce1

Code

public function testProfileMigrations() {

  // Create the profile migration derivatives.
  $migrations = $this->pluginManager
    ->createInstances([
    'commerce1_profile',
  ]);

  // Test that variations exist for billing and shipping and that they have
  // a process for the address.
  $profile_types = [
    'billing',
    'shipping',
  ];
  foreach ($profile_types as $type) {
    $derivative = "commerce1_profile:{$type}";
    $this
      ->assertArrayHasKey($derivative, $migrations, "Commerce profile '{$type}' migrations do not exist after profile installed");

    /** @var \Drupal\migrate\Plugin\migration $migration */
    $migration = $migrations[$derivative];
    $process = $migration
      ->getProcess();
    $this
      ->assertArrayHasKey('address', $process, "Commerce profile '{$type}' does not have address.");
  }
}