public function CommerceCartTestCaseMultiProducts::testCommerceCartFormStructure in Commerce Core 7
Test if the cart form has the correct fields and structure.
File
- modules/
cart/ tests/ commerce_cart.test, line 274 - Functional tests for the commerce cart module.
Class
- CommerceCartTestCaseMultiProducts
- Test cart features for a product display that has several products attached.
Code
public function testCommerceCartFormStructure() {
// Check if the form is present and it has the quantity field, remove and
// submit buttons.
// Go to cart url.
$this
->drupalGet($this
->getCommerceUrl('cart'));
// Check remove button.
$this
->assertFieldByXPath("//input[starts-with(@id, 'edit-edit-delete')]", NULL, t('Remove button present'));
// Check quantity field.
$this
->assertFieldByXPath("//input[starts-with(@id, 'edit-edit-quantity')]", NULL, t('Quantity field present'));
$this
->assertFieldByXPath("//input[starts-with(@id, 'edit-edit-quantity')]", 1, t('Quantity field has correct number of items'));
// Check if the Update cart and Checkout buttons are present.
$this
->assertField("edit-submit", t('Update cart button present'));
$this
->assertField("edit-checkout", t('Checkout button present'));
}