protected function CanadianSalesTaxTest::buildOrder in Commerce Core 8.2
Builds an order for testing purposes.
Return value
\Drupal\commerce_order\Entity\OrderInterface The order.
1 call to CanadianSalesTaxTest::buildOrder()
- CanadianSalesTaxTest::testApplication in modules/
tax/ tests/ src/ Kernel/ Plugin/ Commerce/ TaxType/ CanadianSalesTaxTest.php - @covers ::applies @covers ::apply
File
- modules/
tax/ tests/ src/ Kernel/ Plugin/ Commerce/ TaxType/ CanadianSalesTaxTest.php, line 141
Class
- CanadianSalesTaxTest
- @coversDefaultClass \Drupal\commerce_tax\Plugin\Commerce\TaxType\CanadianSalesTax @group commerce
Namespace
Drupal\Tests\commerce_tax\Kernel\Plugin\Commerce\TaxTypeCode
protected function buildOrder($customer_country, $customer_province) {
$store = Store::create([
'type' => 'default',
'label' => 'My store',
'address' => [
'country_code' => 'CA',
],
'prices_include_tax' => FALSE,
]);
$store
->save();
$customer_profile = Profile::create([
'type' => 'customer',
'uid' => $this->user
->id(),
'address' => [
'country_code' => $customer_country,
'administrative_area' => $customer_province,
],
]);
$customer_profile
->save();
$order_item = OrderItem::create([
'type' => 'test_physical',
'quantity' => 1,
'unit_price' => new Price('10.00', 'USD'),
]);
$order_item
->save();
$order = Order::create([
'type' => 'default',
'uid' => $this->user
->id(),
'store_id' => $store,
'billing_profile' => $customer_profile,
'order_items' => [
$order_item,
],
]);
$order
->save();
return $order;
}