View source
<?php
namespace Drupal\Tests\commerce_migrate_commerce\Kernel\Migrate\commerce1;
use Drupal\Tests\commerce_migrate\Kernel\CommerceMigrateTestTrait;
class ProductVariationTypeTest extends Commerce1TestBase {
use CommerceMigrateTestTrait;
protected static $modules = [
'commerce_price',
'commerce_product',
'commerce_store',
'inline_entity_form',
'path',
];
protected function setUp() : void {
parent::setUp();
$this
->installEntitySchema('view');
$this
->installEntitySchema('commerce_product_variation');
$this
->executeMigration('commerce1_product_variation_type');
}
public function testProductVariationType() {
$type = [
'id' => 'bags_cases',
'label' => 'Bags & Cases',
'order_item_type_id' => 'product',
'is_title_generated' => FALSE,
'traits' => [],
];
$this
->assertProductVariationTypeEntity($type['id'], $type['label'], $type['order_item_type_id'], $type['is_title_generated'], $type['traits']);
$type = [
'id' => 'drinks',
'label' => 'Drinks',
'order_item_type_id' => 'product',
'is_title_generated' => FALSE,
'traits' => [],
];
$this
->assertProductVariationTypeEntity($type['id'], $type['label'], $type['order_item_type_id'], $type['is_title_generated'], $type['traits']);
$type = [
'id' => 'hats',
'label' => 'Hats',
'order_item_type_id' => 'product',
'is_title_generated' => FALSE,
'traits' => [],
];
$this
->assertProductVariationTypeEntity($type['id'], $type['label'], $type['order_item_type_id'], $type['is_title_generated'], $type['traits']);
$type = [
'id' => 'shoes',
'label' => 'Shoes',
'order_item_type_id' => 'product',
'is_title_generated' => FALSE,
'traits' => [],
];
$this
->assertProductVariationTypeEntity($type['id'], $type['label'], $type['order_item_type_id'], $type['is_title_generated'], $type['traits']);
$type = [
'id' => 'storage_devices',
'label' => 'Storage Devices',
'order_item_type_id' => 'product',
'is_title_generated' => FALSE,
'traits' => [],
];
$this
->assertProductVariationTypeEntity($type['id'], $type['label'], $type['order_item_type_id'], $type['is_title_generated'], $type['traits']);
$type = [
'id' => 'tops',
'label' => 'Tops',
'order_item_type_id' => 'product',
'is_title_generated' => FALSE,
'traits' => [],
];
$this
->assertProductVariationTypeEntity($type['id'], $type['label'], $type['order_item_type_id'], $type['is_title_generated'], $type['traits']);
$type = [
'id' => 'product',
'label' => 'Product',
'order_item_type_id' => 'default',
'is_title_generated' => FALSE,
'traits' => [],
];
$this
->assertProductVariationTypeEntity($type['id'], $type['label'], $type['order_item_type_id'], $type['is_title_generated'], $type['traits']);
}
}