You are here

protected function ProfileShippingTest::setUp in Commerce Migrate 8.2

Same name and namespace in other branches
  1. 3.1.x modules/magento/tests/src/Kernel/Migrate/magento2/ProfileShippingTest.php \Drupal\Tests\commerce_migrate_magento\Kernel\Migrate\magento2\ProfileShippingTest::setUp()
  2. 3.0.x modules/magento/tests/src/Kernel/Migrate/magento2/ProfileShippingTest.php \Drupal\Tests\commerce_migrate_magento\Kernel\Migrate\magento2\ProfileShippingTest::setUp()

Overrides CsvTestBase::setUp

File

modules/magento/tests/src/Kernel/Migrate/magento2/ProfileShippingTest.php, line 65

Class

ProfileShippingTest
Tests shipping profile migration.

Namespace

Drupal\Tests\commerce_migrate_magento\Kernel\Migrate\magento2

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installSchema('system', 'sequences');
  $this
    ->installEntitySchema('commerce_order');
  $this
    ->installEntitySchema('profile');
  $this
    ->installEntitySchema('user');
  $this
    ->installSchema('commerce_number_pattern', [
    'commerce_number_pattern_sequence',
  ]);
  $this
    ->installConfig([
    'address',
    'profile',
  ]);
  $this
    ->executeMigrations([
    'magento2_user',
    'magento2_profile_type',
  ]);
  $field_storage_definition = [
    'field_name' => 'address',
    'entity_type' => 'profile',
    'type' => 'address',
    'cardinality' => 1,
  ];
  $storage = FieldStorageConfig::create($field_storage_definition);
  $storage
    ->save();

  // Add address field to shipping type.
  $field_instance = [
    'field_name' => 'address',
    'entity_type' => 'profile',
    'bundle' => 'shipping',
    'label' => 'Shipping',
  ];
  $field = FieldConfig::create($field_instance);
  $field
    ->save();
  $field_storage_definition = [
    'field_name' => 'phone',
    'entity_type' => 'profile',
    'type' => 'telephone',
    'cardinality' => 1,
  ];
  $storage = FieldStorageConfig::create($field_storage_definition);
  $storage
    ->save();
  $field_instance = [
    'field_name' => 'phone',
    'entity_type' => 'profile',
    'bundle' => 'shipping',
    'label' => 'Shipping',
  ];
  $field = FieldConfig::create($field_instance);
  $field
    ->save();
  $this
    ->executeMigration('magento2_profile_shipping');
}