You are here

public function BundleTest::testPurchasableEntityFieldDefinition in Commerce Pricelist 8.2

Tests the 'purchasable_entity' field definition.

File

tests/src/Kernel/BundleTest.php, line 45

Class

BundleTest
Tests the bundles for commerce_pricelist and commerce_pricelist_item.

Namespace

Drupal\Tests\commerce_pricelist\Kernel

Code

public function testPurchasableEntityFieldDefinition() {

  /** @var \Drupal\commerce_pricelist\Entity\PriceListItem $price_list_item */
  $price_list_item = PriceListItem::create([
    'type' => 'commerce_product_variation',
    'price_list_id' => 1,
  ]);
  $price_list_item
    ->save();
  $entity_type_id = $price_list_item
    ->get('purchasable_entity')
    ->getFieldDefinition()
    ->getSetting('target_type');
  $this
    ->assertEquals('commerce_product_variation', $entity_type_id);
}