You are here

public function AlterProductPurchasedEntityEventTest::testGetPurchasedEntity in Commerce Google Tag Manager 8.2

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

@covers ::getPurchasedEntity

File

tests/src/Kernel/AlterProductPurchasedEntityEventTest.php, line 100

Class

AlterProductPurchasedEntityEventTest
@coversDefaultClass \Drupal\commerce_google_tag_manager\Event\AlterProductPurchasedEntityEvent

Namespace

Drupal\Tests\commerce_google_tag_manager\Kernel

Code

public function testGetPurchasedEntity() {
  $event = new AlterProductPurchasedEntityEvent($this->product, $this->orderItem, $this->purchasedEntity);
  $this
    ->assertInstanceOf(PurchasableEntityInterface::class, $event
    ->getPurchasedEntity());
  $event = new AlterProductPurchasedEntityEvent($this->product, $this->orderItem, NULL);
  $this
    ->assertNull($event
    ->getPurchasedEntity());
}