protected function OrderReportGeneratorTest::setUp in Commerce Reporting 8
Overrides CommerceKernelTestBase::setUp
File
- tests/
src/ Kernel/ OrderReportGeneratorTest.php, line 57
Class
- OrderReportGeneratorTest
- Test order report generator service.
Namespace
Drupal\Tests\commerce_reports\KernelCode
protected function setUp() {
parent::setUp();
$this
->installEntitySchema('profile');
$this
->installEntitySchema('commerce_order');
$this
->installEntitySchema('commerce_order_item');
$this
->installEntitySchema('commerce_product');
$this
->installEntitySchema('commerce_product_variation');
$this
->installConfig('commerce_order');
$this
->installConfig('commerce_product');
$this
->installEntitySchema('commerce_order_report');
/** @var \Drupal\commerce_product\Entity\ProductVariationInterface $variation */
$this->variation = ProductVariation::create([
'type' => 'default',
'sku' => $this
->randomMachineName(),
'price' => [
'number' => 999,
'currency_code' => 'USD',
],
]);
$this->variation
->save();
/** @var \Drupal\commerce_product\Entity\ProductInterface $product */
$this->product = Product::create([
'type' => 'default',
'title' => $this
->randomMachineName(),
'stores' => [
$this->store,
],
'variations' => [
$this->variation,
],
]);
$this->product
->save();
/** @var \Drupal\profile\Entity\Profile $profile */
$this->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' => 0,
]);
$this->profile
->save();
}