protected function CartOrderPlacedTest::setUp in Commerce Core 8.2
Overrides CartKernelTestBase::setUp
File
- modules/
cart/ tests/ src/ Kernel/ CartOrderPlacedTest.php, line 25
Class
- CartOrderPlacedTest
- Tests the unsetting of the cart flag when order is placed.
Namespace
Drupal\Tests\commerce_cart\KernelCode
protected function setUp() : void {
parent::setUp();
$this
->createUser();
// Create a product variation.
$this->variation = $this
->createEntity('commerce_product_variation', [
'type' => 'default',
'sku' => $this
->randomMachineName(),
'price' => [
'number' => 999,
'currency_code' => 'USD',
],
]);
// We need a product too otherwise tests complain about the missing
// backreference.
$this
->createEntity('commerce_product', [
'type' => 'default',
'title' => $this
->randomMachineName(),
'stores' => [
$this->store,
],
'variations' => [
$this->variation,
],
]);
$this
->reloadEntity($this->variation);
$this->variation
->save();
// Create a user to use for orders.
$this->user = $this
->createUser();
}