You are here

public function ProductVariationTest::testProductVariation in Commerce Migrate 8.2

Same name in this branch
  1. 8.2 modules/csv_example/tests/src/Kernel/Migrate/ProductVariationTest.php \Drupal\Tests\commerce_migrate_csv_example\Kernel\Migrate\ProductVariationTest::testProductVariation()
  2. 8.2 modules/shopify/tests/src/Kernel/Migrate/ProductVariationTest.php \Drupal\Tests\commerce_migrate_shopify\Kernel\Migrate\shopify\ProductVariationTest::testProductVariation()
  3. 8.2 modules/magento/tests/src/Kernel/Migrate/magento2/ProductVariationTest.php \Drupal\Tests\commerce_migrate_magento\Kernel\Migrate\magento2\ProductVariationTest::testProductVariation()
  4. 8.2 modules/ubercart/tests/src/Kernel/Migrate/uc7/ProductVariationTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc7\ProductVariationTest::testProductVariation()
  5. 8.2 modules/ubercart/tests/src/Kernel/Migrate/uc6/ProductVariationTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc6\ProductVariationTest::testProductVariation()
  6. 8.2 modules/commerce/tests/src/Kernel/Migrate/commerce1/ProductVariationTest.php \Drupal\Tests\commerce_migrate_commerce\Kernel\Migrate\commerce1\ProductVariationTest::testProductVariation()
Same name and namespace in other branches
  1. 3.1.x modules/magento/tests/src/Kernel/Migrate/magento2/ProductVariationTest.php \Drupal\Tests\commerce_migrate_magento\Kernel\Migrate\magento2\ProductVariationTest::testProductVariation()
  2. 3.0.x modules/magento/tests/src/Kernel/Migrate/magento2/ProductVariationTest.php \Drupal\Tests\commerce_migrate_magento\Kernel\Migrate\magento2\ProductVariationTest::testProductVariation()

Test product variation migration.

File

modules/magento/tests/src/Kernel/Migrate/magento2/ProductVariationTest.php, line 74

Class

ProductVariationTest
Tests Product migration.

Namespace

Drupal\Tests\commerce_migrate_magento\Kernel\Migrate\magento2

Code

public function testProductVariation() {
  $variation = [
    'id' => 1,
    'type' => 'bag',
    'uid' => '1',
    'sku' => '24-MB01',
    'price' => '34.000000',
    'currency' => 'USD',
    'product_id' => NULL,
    'title' => 'Joust Duffle Bag',
    'order_item_type_id' => 'default',
    'created_time' => '1521962400',
    'changed_time' => '1521962400',
    'attributes' => NULL,
  ];
  $this
    ->assertProductVariationEntity($variation);
  $variation = [
    'id' => 2,
    'type' => 'bag',
    'uid' => '1',
    'sku' => '24-MB02',
    'price' => '59.000000',
    'currency' => 'USD',
    'product_id' => NULL,
    'title' => 'Fusion Backpack',
    'order_item_type_id' => 'default',
    'created_time' => '1521962400',
    'changed_time' => '1521962400',
    'attributes' => NULL,
  ];
  $this
    ->assertProductVariationEntity($variation);
  $variation = [
    'id' => 3,
    'type' => 'bag',
    'uid' => '1',
    'sku' => '24-UB02',
    'price' => '74.000000',
    'currency' => 'USD',
    'product_id' => NULL,
    'title' => 'Impulse Duffle',
    'order_item_type_id' => 'default',
    'created_time' => '1521962400',
    'changed_time' => '1521962400',
    'attributes' => NULL,
  ];
  $this
    ->assertProductVariationEntity($variation);
  $variation = [
    'id' => 4,
    'type' => 'bag',
    'uid' => '1',
    'sku' => '24-WB01',
    'price' => '32.000000',
    'currency' => 'USD',
    'product_id' => NULL,
    'title' => 'Voyage Yoga Bag',
    'order_item_type_id' => 'default',
    'created_time' => '1521962400',
    'changed_time' => '1521962400',
    'attributes' => NULL,
  ];
  $this
    ->assertProductVariationEntity($variation);
  $variation = [
    'id' => 5,
    'type' => 'bag',
    'uid' => '1',
    'sku' => '24-WB02',
    'price' => '32.000000',
    'currency' => 'USD',
    'product_id' => NULL,
    'title' => 'Compete Track Tote',
    'order_item_type_id' => 'default',
    'created_time' => '1521962400',
    'changed_time' => '1521962400',
    'attributes' => NULL,
  ];
  $this
    ->assertProductVariationEntity($variation);

  // Test a product with a fractional price.
  $variation = [
    'id' => 31,
    'type' => 'bottom',
    'uid' => '1',
    'sku' => 'MSH02-32-Black',
    'price' => '32.500000',
    'currency' => 'USD',
    'product_id' => NULL,
    'title' => 'Apollo Running Short-32-Black',
    'order_item_type_id' => 'default',
    'created_time' => '1521962520',
    'changed_time' => '1521962520',
    'attributes' => NULL,
  ];
  $this
    ->assertProductVariationEntity($variation);
}