public function AttributeTest::testAttributeUiEditAttribute in Ubercart 8.4
Tests the "edit attribute" user interface.
File
- uc_attribute/
tests/ src/ Functional/ AttributeTest.php, line 431
Class
- AttributeTest
- Tests the product attribute API.
Namespace
Drupal\Tests\uc_attribute\FunctionalCode
public function testAttributeUiEditAttribute() {
/** @var \Drupal\Tests\WebAssert $assert */
$assert = $this
->assertSession();
$attribute = $this
->createAttribute();
$this
->drupalGet('admin/store/products/attributes/' . $attribute->aid . '/edit');
$assert
->pageTextContains('Edit attribute: ' . $attribute->name);
$edit = (array) $this
->createAttribute([], FALSE);
$this
->submitForm($edit, 'Submit');
$attribute = uc_attribute_load($attribute->aid);
$fields_ok = TRUE;
foreach ($edit as $field => $value) {
if ($attribute->{$field} != $value) {
$this
->showVar($attribute);
$this
->showVar($edit);
$fields_ok = FALSE;
break;
}
}
$this
->assertTrue($fields_ok, 'Attribute edited properly.');
}