You are here

public function ProductAttributeTest::testProductAttributeDeletion in Commerce Core 8.2

Tests deletion of a product attribute.

File

modules/product/tests/src/Functional/ProductAttributeTest.php, line 84

Class

ProductAttributeTest
Create, edit, delete, and change product attributes.

Namespace

Drupal\Tests\commerce_product\Functional

Code

public function testProductAttributeDeletion() {
  $this
    ->createEntity('commerce_product_attribute', [
    'id' => 'size',
    'label' => 'Size',
  ]);
  $this
    ->drupalGet('admin/commerce/product-attributes/manage/size/delete');
  $this
    ->assertSession()
    ->pageTextContains('Are you sure you want to delete the product attribute Size?');
  $this
    ->assertSession()
    ->pageTextContains('This action cannot be undone.');
  $this
    ->submitForm([], 'Delete');
  $this
    ->assertNull(ProductAttribute::load('size'));
}