public function StoreTaxTest::testDefaultTaxType in Commerce Core 8.2
@covers ::getDefaultTaxType
File
- modules/
tax/ tests/ src/ Kernel/ StoreTaxTest.php, line 96
Class
- StoreTaxTest
- @coversDefaultClass \Drupal\commerce_tax\StoreTax @group commerce
Namespace
Drupal\Tests\commerce_tax\KernelCode
public function testDefaultTaxType() {
$tax_type = $this->storeTax
->getDefaultTaxType($this->store);
$this
->assertNotNull($tax_type);
$this
->assertEquals($this->taxType
->id(), $tax_type
->id());
// Confirm that disabled tax types are not returned.
$this->taxType
->setStatus(FALSE);
$this->taxType
->save();
$this->storeTax
->clearCaches();
$tax_type = $this->storeTax
->getDefaultTaxType($this->store);
$this
->assertNull($tax_type);
// Confirm that non-display-inclusive tax types are not returned.
$this->taxType
->setStatus(TRUE);
$this->taxType
->setPluginConfiguration([
'display_inclusive' => FALSE,
]);
$this->taxType
->save();
$this->storeTax
->clearCaches();
$tax_type = $this->storeTax
->getDefaultTaxType($this->store);
$this
->assertNull($tax_type);
// Confirm that non-applicable tax types are not returned.
$second_store = $this
->createStore('Second store', 'admin2@example.com', 'online', FALSE, 'US');
$tax_type = $this->storeTax
->getDefaultTaxType($second_store);
$this
->assertNull($tax_type);
}