public function EventTrackerServiceTest::testBuildProductFromProductVariation in Commerce Google Tag Manager 8
Same name and namespace in other branches
- 8.2 tests/src/Kernel/EventTrackerServiceTest.php \Drupal\Tests\commerce_google_tag_manager\Kernel\EventTrackerServiceTest::testBuildProductFromProductVariation()
@covers ::buildProductFromProductVariation
File
- tests/
src/ Kernel/ EventTrackerServiceTest.php, line 63
Class
- EventTrackerServiceTest
- @coversDefaultClass \Drupal\commerce_google_tag_manager\EventTrackerService
Namespace
Drupal\Tests\commerce_google_tag_manager\KernelCode
public function testBuildProductFromProductVariation() {
// The variations to test with.
$variation = ProductVariation::create([
'type' => 'default',
'sku' => $this
->randomString(10),
'status' => TRUE,
'price' => new Price('11.00', 'USD'),
]);
$variation
->save();
$this->product
->addVariation($variation)
->save();
$result = $this
->invokeMethod($this->eventTracker, 'buildProductFromProductVariation', [
$variation,
]);
$this
->assertInstanceOf(Product::class, $result);
$this
->assertEquals($result
->getPrice(), 11);
}