You are here

public function CommerceMigrateTestTrait::assertTaxType in Commerce Migrate 3.0.x

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

Asserts a tax type.

Parameters

int $id: The TaxType id.

string $label: The label for the TaxType.

string $plugin: The TaxType plugin.

string $rate: The TaxType rate.

array $territories: The territories this tax type is applied to.

3 calls to CommerceMigrateTestTrait::assertTaxType()
TaxTypeTest::testTaxType in modules/ubercart/tests/src/Kernel/Migrate/uc7/TaxTypeTest.php
Test tax migration.
TaxTypeTest::testTaxType in modules/ubercart/tests/src/Kernel/Migrate/uc6/TaxTypeTest.php
Test tax migration.
TaxTypeTest::testTaxType in modules/commerce/tests/src/Kernel/Migrate/commerce1/TaxTypeTest.php
Test tax migration.

File

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

Class

CommerceMigrateTestTrait
Helper function to test migrations.

Namespace

Drupal\Tests\commerce_migrate\Kernel

Code

public function assertTaxType($id, $label, $plugin, $rate, array $territories) {
  $tax_type = TaxType::load($id);
  $this
    ->assertInstanceOf(TaxType::class, $tax_type);
  $this
    ->assertSame($label, $tax_type
    ->label());
  $this
    ->assertSame($plugin, $tax_type
    ->getPluginId());
  $tax_type_config = $tax_type
    ->getPluginConfiguration();
  $this
    ->assertSame($id, $tax_type_config['rates'][0]['id']);
  $this
    ->assertSame($label, $tax_type_config['rates'][0]['label']);
  $this
    ->assertSame($rate, $tax_type_config['rates'][0]['percentage']);
  $this
    ->assertSame($territories, $tax_type_config['territories']);
}