protected function PromotionStorageTest::setUp in Commerce Core 8.2
Overrides OrderKernelTestBase::setUp
File
- modules/
promotion/ tests/ src/ Kernel/ PromotionStorageTest.php, line 53
Class
- PromotionStorageTest
- Tests promotion storage.
Namespace
Drupal\Tests\commerce_promotion\KernelCode
protected function setUp() : void {
parent::setUp();
$this
->installEntitySchema('commerce_promotion');
$this
->installEntitySchema('commerce_promotion_coupon');
$this
->installConfig([
'commerce_promotion',
]);
$this
->installSchema('commerce_promotion', [
'commerce_promotion_usage',
]);
$this->promotionStorage = $this->container
->get('entity_type.manager')
->getStorage('commerce_promotion');
$this->orderType = OrderType::load('default');
$order_item = OrderItem::create([
'type' => 'default',
'quantity' => 1,
'unit_price' => new Price('12.00', 'USD'),
]);
$order_item
->save();
$this->order = Order::create([
'type' => 'default',
'mail' => 'test@example.com',
'ip_address' => '127.0.0.1',
'order_number' => '6',
'store_id' => $this->store,
'uid' => $this
->createUser(),
'order_items' => [
$order_item,
],
'state' => 'completed',
// Used when determining availability, via $order->getCalculationDate().
'placed' => strtotime('2019-11-15 10:14:00'),
]);
}