You are here

public function EuropeanUnionVatTest::testGetZones in Commerce Core 8.2

@covers ::getZones

3 methods override EuropeanUnionVatTest::testGetZones()
NorwegianVatTest::testGetZones in modules/tax/tests/src/Kernel/Plugin/Commerce/TaxType/NorwegianVatTest.php
@covers ::getZones
SwissVatTest::testGetZones in modules/tax/tests/src/Kernel/Plugin/Commerce/TaxType/SwissVatTest.php
@covers ::getZones
UnitedKingdomVatTest::testGetZones in modules/tax/tests/src/Kernel/Plugin/Commerce/TaxType/UnitedKingdomVatTest.php
@covers ::getZones

File

modules/tax/tests/src/Kernel/Plugin/Commerce/TaxType/EuropeanUnionVatTest.php, line 188

Class

EuropeanUnionVatTest
@coversDefaultClass \Drupal\commerce_tax\Plugin\Commerce\TaxType\EuropeanUnionVat @group commerce

Namespace

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

Code

public function testGetZones() {

  /** @var \Drupal\commerce_tax\Plugin\Commerce\TaxType\LocalTaxTypeInterface $plugin */
  $plugin = $this->taxType
    ->getPlugin();
  $zones = $plugin
    ->getZones();
  $this
    ->assertArrayHasKey('be', $zones);
  $this
    ->assertArrayHasKey('es', $zones);
  $this
    ->assertArrayHasKey('fr', $zones);
  $this
    ->assertArrayHasKey('it', $zones);
  $this
    ->assertArrayHasKey('de', $zones);
  $germany_tax_rates = $zones['de']
    ->getRates();
  $standard_rate = $germany_tax_rates['standard']
    ->toArray();

  // Ensure the "fake" tax rate percentage added by our test subscriber is present.
  $fake_percentage = end($standard_rate['percentages']);
  $this
    ->assertEquals([
    'number' => '0.25',
    'start_date' => '2041-01-01',
  ], $fake_percentage);
}