public function AttributeTest::testAttributeUiAttributeOptionsEdit in Ubercart 8.4
Tests the "edit attribute options" user interface.
File
- uc_attribute/
tests/ src/ Functional/ AttributeTest.php, line 524
Class
- AttributeTest
- Tests the product attribute API.
Namespace
Drupal\Tests\uc_attribute\FunctionalCode
public function testAttributeUiAttributeOptionsEdit() {
/** @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 . '/edit');
$assert
->pageTextContains('Edit option: ' . $option->name);
$edit = (array) $this
->createAttributeOption([
'aid' => $attribute->aid,
], FALSE);
unset($edit['aid']);
$this
->drupalGet('admin/store/products/attributes/' . $attribute->aid . '/options/' . $option->oid . '/edit');
$this
->submitForm($edit, 'Submit');
$option = uc_attribute_option_load($option->oid);
$fields_ok = TRUE;
foreach ($edit as $field => $value) {
if ($option->{$field} != $value) {
$this
->showVar($option);
$this
->showVar($edit);
$fields_ok = FALSE;
break;
}
}
$this
->assertTrue($fields_ok, 'Attribute option edited successfully by form.');
}