protected function PromotionReportTest::setUp in Commerce Reporting 8
Overrides CommerceKernelTestBase::setUp
File
- tests/
src/ Kernel/ ReportType/ PromotionReportTest.php, line 59
Class
- PromotionReportTest
- Tests the `commerce_order_report` entity.
Namespace
Drupal\Tests\commerce_reports\Kernel\ReportTypeCode
protected function setUp() {
parent::setUp();
$this
->installEntitySchema('profile');
$this
->installEntitySchema('commerce_order');
$this
->installEntitySchema('commerce_order_item');
$this
->installEntitySchema('commerce_order_report');
$this
->installEntitySchema('commerce_promotion');
$this
->installEntitySchema('commerce_promotion_coupon');
$this
->installConfig('commerce_order', 'commerce_promotion');
$this->reportTypeManager = $this->container
->get('plugin.manager.commerce_report_type');
$user = $this
->createUser([
'mail' => $this
->randomString() . '@example.com',
]);
$this->user = $this
->reloadEntity($user);
OrderItemType::create([
'id' => 'test',
'label' => 'Test',
'orderType' => 'default',
])
->save();
/** @var \Drupal\profile\Entity\Profile $profile */
$profile = Profile::create([
'type' => 'customer',
'address' => [
'country_code' => 'US',
'postal_code' => '53177',
'locality' => 'Milwaukee',
'address_line1' => 'Pabst Blue Ribbon Dr',
'administrative_area' => 'WI',
'given_name' => 'Frederick',
'family_name' => 'Pabst',
],
'uid' => $this->user
->id(),
]);
$profile
->save();
/** @var \Drupal\commerce_order\Entity\Order $order */
$this->order = Order::create([
'order_id' => 1234,
'type' => 'default',
'state' => 'completed',
'placed' => '1518491883',
'mail' => $this->user
->getEmail(),
'uid' => $this->user
->id(),
'ip_address' => '127.0.0.1',
'order_number' => '6',
'billing_profile' => $profile,
'store_id' => $this->store
->id(),
]);
}