You are here

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

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

@covers ::productDetailViews

@dataProvider productVariationProvider

File

tests/src/Unit/EventTrackerServiceTest.php, line 119

Class

EventTrackerServiceTest
Tests for the EventTracker service.

Namespace

Drupal\Tests\commerce_google_tag_manager\Unit

Code

public function testProductClick($product_variation, $product_data) {
  $this->eventStorage
    ->expects($this
    ->once())
    ->method('addEvent')
    ->with([
    'event' => EventTrackerService::EVENT_PRODUCT_CLICK,
    'ecommerce' => [
      'click' => [
        'actionField' => [
          'list' => 'List Name',
        ],
        'products' => [
          $product_data,
        ],
      ],
    ],
  ]);
  $this->eventTracker
    ->productClick([
    $product_variation,
  ], 'List Name');
}