You are here

public function EventTrackerServiceTest::testBuildProductFromProductVariationNoPrice in Commerce Google Tag Manager 8.2

Same name and namespace in other branches
  1. 8 tests/src/Kernel/EventTrackerServiceTest.php \Drupal\Tests\commerce_google_tag_manager\Kernel\EventTrackerServiceTest::testBuildProductFromProductVariationNoPrice()

@covers ::buildProductFromProductVariation

File

tests/src/Kernel/EventTrackerServiceTest.php, line 107

Class

EventTrackerServiceTest
@coversDefaultClass \Drupal\commerce_google_tag_manager\EventTrackerService

Namespace

Drupal\Tests\commerce_google_tag_manager\Kernel

Code

public function testBuildProductFromProductVariationNoPrice() {

  // The variations to test with.
  $variation = ProductVariation::create([
    'type' => 'default',
    'sku' => $this
      ->randomString(10),
    'status' => TRUE,
  ]);
  $variation
    ->save();
  $this->product
    ->addVariation($variation)
    ->save();
  $this
    ->expectException(\TypeError::class);
  $this
    ->invokeMethod($this->eventTracker, 'buildProductFromProductVariation', [
    $variation,
  ]);
}