You are here

protected function CustomTest::setUp in Commerce Core 8.2

Overrides OrderKernelTestBase::setUp

File

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

Class

CustomTest
@coversDefaultClass \Drupal\commerce_tax\Plugin\Commerce\TaxType\Custom @group commerce

Namespace

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

Code

protected function setUp() : void {
  parent::setUp();
  $this
    ->installConfig([
    'commerce_tax',
  ]);
  $user = $this
    ->createUser();
  $this->user = $this
    ->reloadEntity($user);
  $this->taxType = TaxType::create([
    'id' => 'serbian_vat',
    'label' => 'Serbian VAT',
    'plugin' => 'custom',
    'configuration' => [
      'display_inclusive' => TRUE,
      'display_label' => 'vat',
      'round' => TRUE,
      'rates' => [
        [
          'id' => 'standard',
          'label' => 'Standard',
          'percentage' => '0.2',
        ],
        [
          'id' => 'reduced',
          'label' => 'Reduced',
          'percentage' => '0.1',
        ],
      ],
      'territories' => [
        [
          'country_code' => 'RS',
        ],
      ],
    ],
    // Don't allow the tax type to apply automatically.
    'status' => FALSE,
  ]);
  $this->taxType
    ->save();
}