public function ShippingTest::testApplies in Commerce Shipping 8.2
@covers ::applies
File
- tests/
src/ Kernel/ Plugin/ Commerce/ TaxType/ ShippingTest.php, line 203
Class
- ShippingTest
- Tests the shipping tax type.
Namespace
Drupal\Tests\commerce_shipping\Kernel\Plugin\Commerce\TaxTypeCode
public function testApplies() {
$plugin = $this->taxType
->getPlugin();
$this
->assertTrue($plugin
->applies($this->order));
// Confirm that non-shippable orders are ignored.
$order = clone $this->order;
$order
->setItems([]);
$this
->assertFalse($plugin
->applies($order));
// Confirm that orders without shipments are ignored.
$order = clone $this->order;
$order
->set('shipments', []);
$this
->assertFalse($plugin
->applies($order));
// Confirm that the tax type can be limited by store.
$order = clone $this->order;
$order
->setStore($this
->createStore());
$plugin
->setConfiguration([
'store_filter' => 'include',
'stores' => [
$this->store
->uuid(),
],
]);
$this
->assertFalse($plugin
->applies($order));
$this
->assertTrue($plugin
->applies($this->order));
$plugin
->setConfiguration([
'store_filter' => 'exclude',
'stores' => [
$this->store
->uuid(),
],
]);
$this
->assertTrue($plugin
->applies($order));
$this
->assertFalse($plugin
->applies($this->order));
}