You are here

public function NorwegianVatTest::testApplication in Commerce Core 8.2

@covers ::applies @covers ::apply

Overrides EuropeanUnionVatTest::testApplication

File

modules/tax/tests/src/Kernel/Plugin/Commerce/TaxType/NorwegianVatTest.php, line 36

Class

NorwegianVatTest
@coversDefaultClass \Drupal\commerce_tax\Plugin\Commerce\TaxType\NorwegianVat @group commerce

Namespace

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

Code

public function testApplication() {
  $plugin = $this->taxType
    ->getPlugin();

  // Norwegian customer, Norwegian store, standard VAT.
  $order = $this
    ->buildOrder('NO', 'NO');
  $this
    ->assertTrue($plugin
    ->applies($order));
  $plugin
    ->apply($order);
  $adjustments = $order
    ->collectAdjustments();
  $adjustment = reset($adjustments);
  $this
    ->assertCount(1, $adjustments);
  $this
    ->assertEquals('norwegian_vat|no|standard', $adjustment
    ->getSourceId());

  // Polish customer, Norwegian store, no VAT.
  $order = $this
    ->buildOrder('PL', 'NO');
  $this
    ->assertTrue($plugin
    ->applies($order));
  $plugin
    ->apply($order);
  $adjustments = $order
    ->collectAdjustments();
  $this
    ->assertCount(0, $adjustments);
}