You are here

public function CommerceMigrateTestTrait::assertAddressItem in Commerce Migrate 8.2

Same name and namespace in other branches
  1. 3.1.x tests/src/Kernel/CommerceMigrateTestTrait.php \Drupal\Tests\commerce_migrate\Kernel\CommerceMigrateTestTrait::assertAddressItem()
  2. 3.0.x tests/src/Kernel/CommerceMigrateTestTrait.php \Drupal\Tests\commerce_migrate\Kernel\CommerceMigrateTestTrait::assertAddressItem()

Asserts an address field.

Parameters

\Drupal\address\AddressInterface $address: The address id.

string $country: The country code.

string $administrative_area: The administrative area.

string $locality: The locality.

string $dependent_locality: The dependent locality.

string $postal_code: The postal code.

string $sorting_code: The sorting code.

string $address_line_1: Address line 1.

string $address_line_2: Address line 2.

string $given_name: The given name.

string $additional_name: Any additional names.

string $family_name: The family name.

string $organization: The organization string.

2 calls to CommerceMigrateTestTrait::assertAddressItem()
StoreTest::testStore in modules/ubercart/tests/src/Kernel/Migrate/uc7/StoreTest.php
Test store migration.
StoreTest::testStore in modules/ubercart/tests/src/Kernel/Migrate/uc6/StoreTest.php
Test store migration.

File

tests/src/Kernel/CommerceMigrateTestTrait.php, line 110

Class

CommerceMigrateTestTrait
Helper function to test migrations.

Namespace

Drupal\Tests\commerce_migrate\Kernel

Code

public function assertAddressItem(AddressInterface $address, $country, $administrative_area, $locality, $dependent_locality, $postal_code, $sorting_code, $address_line_1, $address_line_2, $given_name, $additional_name, $family_name, $organization) {
  $this
    ->assertInstanceOf(AddressItem::class, $address);
  $this
    ->assertSame($country, $address
    ->getCountryCode());
  $this
    ->assertSame($administrative_area, $address
    ->getAdministrativeArea());
  $this
    ->assertSame($locality, $address
    ->getLocality());
  $this
    ->assertSame($dependent_locality, $address
    ->getDependentLocality());
  $this
    ->assertSame($postal_code, $address
    ->getPostalCode());
  $this
    ->assertSame($sorting_code, $address
    ->getSortingCode());
  $this
    ->assertSame($address_line_1, $address
    ->getAddressLine1());
  $this
    ->assertSame($address_line_2, $address
    ->getAddressLine2());
  $this
    ->assertSame($given_name, $address
    ->getGivenName());
  $this
    ->assertSame($additional_name, $address
    ->getAdditionalName());
  $this
    ->assertSame($family_name, $address
    ->getFamilyName());
  $this
    ->assertSame($organization, $address
    ->getOrganization());
}