public function UnitedKingdomVatTest::testApplication in Commerce Core 8.2
@covers ::applies @covers ::apply
Overrides EuropeanUnionVatTest::testApplication
File
- modules/
tax/ tests/ src/ Kernel/ Plugin/ Commerce/ TaxType/ UnitedKingdomVatTest.php, line 36
Class
- UnitedKingdomVatTest
- @coversDefaultClass \Drupal\commerce_tax\Plugin\Commerce\TaxType\UnitedKingdomVat @group commerce
Namespace
Drupal\Tests\commerce_tax\Kernel\Plugin\Commerce\TaxTypeCode
public function testApplication() {
$plugin = $this->taxType
->getPlugin();
// GB customer, GB store, standard VAT.
$order = $this
->buildOrder('GB', 'GB');
$this
->assertTrue($plugin
->applies($order));
$plugin
->apply($order);
$adjustments = $order
->collectAdjustments();
$adjustment = reset($adjustments);
$this
->assertCount(1, $adjustments);
$this
->assertEquals('united_kingdom_vat|gb|standard', $adjustment
->getSourceId());
// Customer from Isles of Man, GB store, standard VAT.
$order = $this
->buildOrder('IM', 'GB');
$this
->assertTrue($plugin
->applies($order));
$plugin
->apply($order);
$adjustments = $order
->collectAdjustments();
$adjustment = reset($adjustments);
$this
->assertCount(1, $adjustments);
$this
->assertEquals('united_kingdom_vat|gb|standard', $adjustment
->getSourceId());
// French customer, GB store, no VAT.
$order = $this
->buildOrder('FR', 'GB');
$this
->assertTrue($plugin
->applies($order));
$plugin
->apply($order);
$adjustments = $order
->collectAdjustments();
$this
->assertCount(0, $adjustments);
}