You are here

protected function ProfileCustomerTest::setUp in Commerce Migrate 3.1.x

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

Overrides CsvTestBase::setUp

File

modules/magento/tests/src/Kernel/Migrate/magento2/ProfileCustomerTest.php, line 64

Class

ProfileCustomerTest
Tests billing profile migration.

Namespace

Drupal\Tests\commerce_migrate_magento\Kernel\Migrate\magento2

Code

protected function setUp() : void {
  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' => 'customer',
    'label' => 'Customer',
  ];
  $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' => 'customer',
    'label' => 'Customer',
  ];
  $field = FieldConfig::create($field_instance);
  $field
    ->save();
  $this
    ->executeMigration('magento2_profile_customer');
}