You are here

public function ProfileShippingTest::testProfileBilling 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::testProfileBilling()
  2. 3.0.x modules/magento/tests/src/Kernel/Migrate/magento2/ProfileShippingTest.php \Drupal\Tests\commerce_migrate_magento\Kernel\Migrate\magento2\ProfileShippingTest::testProfileBilling()

Test profile migration.

File

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

Class

ProfileShippingTest
Tests shipping profile migration.

Namespace

Drupal\Tests\commerce_migrate_magento\Kernel\Migrate\magento2

Code

public function testProfileBilling() {
  $this
    ->assertProfile(1, 'shipping', '1', 'und', TRUE, TRUE, NULL, NULL);
  $profile = Profile::load(1);
  $address = $profile
    ->get('address')
    ->first()
    ->getValue();
  $this
    ->assertAddressField($address, 'US', 'Michigan', 'Calder', NULL, '49628-7978', NULL, '6146 Honey Bluff Parkway', 'Apartment 242', 'Veronica', NULL, 'Costello', '');
  $phone = [
    [
      'value' => '(555) 229-3326',
    ],
  ];
  $this
    ->assertSame($phone, $profile
    ->get('phone')
    ->getValue());
  $this
    ->assertProfile(2, 'shipping', '2', 'und', TRUE, TRUE, NULL, NULL);
  $profile = Profile::load(2);
  $address = $profile
    ->get('address')
    ->first()
    ->getValue();
  $this
    ->assertAddressField($address, 'US', 'Maryland', 'Towson', NULL, '21210', NULL, '123 Hawk Way', NULL, 'Tui', NULL, 'Song', '');
  $phone = [
    [
      'value' => '111-2222',
    ],
  ];
  $this
    ->assertSame($phone, $profile
    ->get('phone')
    ->getValue());

  // Test revisions.

  /** @var \Drupal\profile\Entity\ProfileInterface $profile_revision */
  $profile_revision = \Drupal::entityTypeManager()
    ->getStorage('profile')
    ->loadRevision(3);
  $this
    ->assertNull($profile_revision);
}