You are here

public function ProductVariationDeriverTest::testProductVariationMigrations in Commerce Migrate 8.2

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

Test product variation migrations.

File

modules/commerce/tests/src/Kernel/Migrate/commerce1/ProductVariationDeriverTest.php, line 39

Class

ProductVariationDeriverTest
Test Product Variation Deriver.

Namespace

Drupal\Tests\commerce_migrate_commerce\Kernel\Migrate\commerce1

Code

public function testProductVariationMigrations() {

  // Create the product variation derivatives.
  $migrations = $this->pluginManager
    ->createInstances([
    'commerce1_product_variation',
  ]);

  // Test that the variation for drinks exists.
  $this
    ->assertArrayHasKey('commerce1_product_variation:drinks', $migrations, "Commerce product variation migrations exist after commerce_product installed");

  // Test that the fields for shoes exist in the show migration.

  /** @var \Drupal\migrate\Plugin\migration $migration */
  $migration = $migrations['commerce1_product_variation:shoes'];
  $process = $migration
    ->getProcess();
  $this
    ->assertArrayHasKey('field_employee_price_shoes', $process, "Commerce product variation shoes has employee_price_shoes field.");
  $migration = $migrations['commerce1_product_variation:drinks'];
  $process = $migration
    ->getProcess();
  $this
    ->assertArrayHasKey('field_employee_price', $process, "Commerce product variation drinks has employee_price field.");
}