You are here

protected function CanadianSalesTaxTest::setUp in Commerce Core 8.2

Overrides OrderKernelTestBase::setUp

File

modules/tax/tests/src/Kernel/Plugin/Commerce/TaxType/CanadianSalesTaxTest.php, line 47

Class

CanadianSalesTaxTest
@coversDefaultClass \Drupal\commerce_tax\Plugin\Commerce\TaxType\CanadianSalesTax @group commerce

Namespace

Drupal\Tests\commerce_tax\Kernel\Plugin\Commerce\TaxType

Code

protected function setUp() : void {
  parent::setUp();
  $this
    ->installConfig([
    'commerce_tax',
  ]);

  // Order item types that doesn't need a purchasable entity, for simplicity.
  OrderItemType::create([
    'id' => 'test_physical',
    'label' => 'Test (Physical)',
    'orderType' => 'default',
    'third_party_settings' => [
      'commerce_tax' => [
        'taxable_type' => TaxableType::PHYSICAL_GOODS,
      ],
    ],
  ])
    ->save();
  $user = $this
    ->createUser();
  $this->user = $this
    ->reloadEntity($user);
  $this->taxType = TaxType::create([
    'id' => 'canadian_sales_tax',
    'label' => 'Canadian Sales Tax',
    'plugin' => 'canadian_sales_tax',
    'configuration' => [
      'display_inclusive' => FALSE,
    ],
    // Don't allow the tax type to apply automatically.
    'status' => FALSE,
  ]);
  $this->taxType
    ->save();
}