You are here

public function UbercartAttributeTestCase::testAttributeUIAttributeOptionsDelete in Ubercart 7.3

Same name and namespace in other branches
  1. 6.2 uc_attribute/uc_attribute.test \UbercartAttributeTestCase::testAttributeUIAttributeOptionsDelete()

Tests the "delete attribute option" user interface.

File

uc_attribute/tests/uc_attribute.test, line 517
Ubercart Attribute Tests.

Class

UbercartAttributeTestCase
SimpleTests for the Ubercart Attributes API.

Code

public function testAttributeUIAttributeOptionsDelete() {
  $attribute = self::createAttribute();
  $option = self::createAttributeOption(array(
    'aid' => $attribute->aid,
  ));
  uc_attribute_option_save($option);
  $this
    ->drupalGet('admin/store/products/attributes/' . $attribute->aid . '/options/' . $option->oid . '/delete');
  $this
    ->assertText(t('Are you sure you want to delete the option @name?', array(
    '@name' => $option->name,
  )), t('Attribute options delete form working.'));
  $this
    ->drupalPost('admin/store/products/attributes/' . $attribute->aid . '/options/' . $option->oid . '/delete', array(), t('Delete'));
  $option = uc_attribute_option_load($option->oid);
  $this
    ->assertFalse($option, t('Attribute option deleted successfully by form'));
}