You are here

protected function ProductDetailViewsTest::setUp in Commerce Google Tag Manager 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/ProductDetailViewsTest.php \Drupal\Tests\commerce_google_tag_manager\Functional\ProductDetailViewsTest::setUp()

Overrides CommerceBrowserTestBase::setUp

File

tests/src/Functional/ProductDetailViewsTest.php, line 45

Class

ProductDetailViewsTest
@coversDefaultClass \Drupal\commerce_google_tag_manager\EventSubscriber\CommerceEventsSubscriber

Namespace

Drupal\Tests\commerce_google_tag_manager\Functional

Code

protected function setUp() : void {
  parent::setUp();
  $this->tempStore = $this->container
    ->get('tempstore.private')
    ->get('commerce_google_tag_manager');
  $this->product = Product::create([
    'type' => 'default',
    'title' => 'Lorem Ipsum',
  ]);
  $this->product
    ->save();
  $variation = ProductVariation::create([
    'type' => 'default',
    'sku' => 'lorem-ipsum-120',
    'title' => 'Lorem Ipsum',
    'price' => new Price('120.00', 'USD'),
    'status' => TRUE,
  ]);
  $this->product
    ->addVariation($variation)
    ->save();
}