You are here

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

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

@covers ::buildProductFromProductVariation

File

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

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
    ->expectExceptionMessage('Argument 1 passed to Drupal\\commerce_order\\PriceCalculatorResult::__construct() must be an instance of Drupal\\commerce_price\\Price, null given');
  $this
    ->invokeMethod($this->eventTracker, 'buildProductFromProductVariation', [
    $variation,
  ]);
}