You are here

public function PriceListItemTest::testDeletion in Commerce Pricelist 8.2

Test that price list items are deleted after their variation is deleted.

File

tests/src/Kernel/Entity/PriceListItemTest.php, line 118

Class

PriceListItemTest
Tests the price list item entity.

Namespace

Drupal\Tests\commerce_pricelist\Kernel\Entity

Code

public function testDeletion() {
  $price_list_item = PriceListItem::create([
    'type' => 'commerce_product_variation',
    'price_list_id' => $this->priceList
      ->id(),
    'purchasable_entity' => $this->variation
      ->id(),
    'quantity' => '10',
  ]);
  $price_list_item
    ->save();
  $this->variation
    ->delete();
  $this
    ->assertNull($this
    ->reloadEntity($price_list_item));
}