You are here

public function AttributeTest::testAttributeUiAttributeOptionsDelete in Ubercart 8.4

Tests the "delete attribute option" user interface.

File

uc_attribute/tests/src/Functional/AttributeTest.php, line 559

Class

AttributeTest
Tests the product attribute API.

Namespace

Drupal\Tests\uc_attribute\Functional

Code

public function testAttributeUiAttributeOptionsDelete() {

  /** @var \Drupal\Tests\WebAssert $assert */
  $assert = $this
    ->assertSession();
  $attribute = $this
    ->createAttribute();
  $option = $this
    ->createAttributeOption([
    'aid' => $attribute->aid,
  ]);
  uc_attribute_option_save($option);
  $this
    ->drupalGet('admin/store/products/attributes/' . $attribute->aid . '/options/' . $option->oid . '/delete');
  $assert
    ->pageTextContains('Are you sure you want to delete the option ' . $option->name . '?');
  $this
    ->submitForm([], 'Delete');
  $option = uc_attribute_option_load($option->oid);
  $this
    ->assertFalse($option, 'Attribute option deleted successfully by form');
}