You are here

public function ShippingOrderManagerTest::testCreateProfile in Commerce Shipping 8.2

@covers ::createProfile

File

tests/src/Kernel/ShippingOrderManagerTest.php, line 122

Class

ShippingOrderManagerTest
Tests the shipping order manager.

Namespace

Drupal\Tests\commerce_shipping\Kernel

Code

public function testCreateProfile() {
  $profile = $this->shippingOrderManager
    ->createProfile($this->shippableOrder);
  $this
    ->assertEquals('customer', $profile
    ->bundle());
  $profile_type = ProfileType::create([
    'id' => 'customer_shipping',
    'label' => $this
      ->randomString(),
  ]);
  $profile_type
    ->setThirdPartySetting('commerce_order', 'customer_profile_type', TRUE);
  $profile_type
    ->save();
  $shipment_type = ShipmentType::load('default');
  $shipment_type
    ->setProfileTypeId('customer_shipping');
  $shipment_type
    ->save();
  $profile = $this->shippingOrderManager
    ->createProfile($this->shippableOrder);
  $this
    ->assertEquals('customer_shipping', $profile
    ->bundle());
}