You are here

public function AddressBookTest::testLoadProfileTypes in Commerce Core 8.2

@covers ::loadTypes

File

modules/order/tests/src/Kernel/AddressBookTest.php, line 133

Class

AddressBookTest
Tests the address book.

Namespace

Drupal\Tests\commerce_order\Kernel

Code

public function testLoadProfileTypes() {
  $profile_types = $this->addressBook
    ->loadTypes();
  $this
    ->assertCount(1, $profile_types);
  $this
    ->assertArrayHasKey('customer', $profile_types);
  $bundle_entity_duplicator = $this->container
    ->get('entity.bundle_entity_duplicator');
  $customer_profile_type = ProfileType::load('customer');
  $bundle_entity_duplicator
    ->duplicate($customer_profile_type, [
    'id' => 'shipping',
    'label' => 'Shipping',
  ]);
  $test_profile_type = ProfileType::create([
    'id' => 'test',
    'label' => 'Test',
  ]);
  $test_profile_type
    ->save();
  $profile_types = $this->addressBook
    ->loadTypes();
  $this
    ->assertCount(2, $profile_types);
  $this
    ->assertArrayNotHasKey('test', $profile_types);
}