You are here

protected function StoreTaxTest::setUp in Commerce Core 8.2

Overrides OrderKernelTestBase::setUp

File

modules/tax/tests/src/Kernel/StoreTaxTest.php, line 51

Class

StoreTaxTest
@coversDefaultClass \Drupal\commerce_tax\StoreTax @group commerce

Namespace

Drupal\Tests\commerce_tax\Kernel

Code

protected function setUp() : void {
  parent::setUp();
  $this
    ->installConfig([
    'commerce_tax',
  ]);
  $user = $this
    ->createUser([
    'mail' => $this
      ->randomString() . '@example.com',
  ]);
  $this->store
    ->set('address', [
    'country_code' => 'FR',
    'locality' => 'Paris',
    'postal_code' => '75002',
    'address_line1' => '38 Rue du Sentier',
  ]);
  $this->store
    ->set('prices_include_tax', TRUE);
  $this->store
    ->save();
  $this->storeTax = $this->container
    ->get('commerce_tax.store_tax');
  $tax_type = TaxType::create([
    'id' => 'eu_vat',
    'label' => 'EU VAT',
    'plugin' => 'european_union_vat',
    'configuration' => [
      'display_inclusive' => TRUE,
    ],
    'status' => TRUE,
  ]);
  $tax_type
    ->save();
  $this->taxType = $this
    ->reloadEntity($tax_type);
  $order = Order::create([
    'type' => 'default',
    'store_id' => $this->store
      ->id(),
    'state' => 'draft',
    'mail' => $user
      ->getEmail(),
    'uid' => $user
      ->id(),
    'ip_address' => '127.0.0.1',
    'order_number' => '6',
  ]);
  $order
    ->save();
  $this->order = $this
    ->reloadEntity($order);
}