public function CommerceCartTestCaseMultiProducts::testCommerceCartSelectProductAdd in Commerce Core 7
Test to select one product and check if it has been correctly added to the cart.
File
- modules/
cart/ tests/ commerce_cart.test, line 257 - Functional tests for the commerce cart module.
Class
- CommerceCartTestCaseMultiProducts
- Test cart features for a product display that has several products attached.
Code
public function testCommerceCartSelectProductAdd() {
// Ensure the add to cart message is displayed.
$message = t('%title added to <a href="!cart-url">your cart</a>.', array(
'%title' => $this->product_titles[1],
'!cart-url' => url('cart'),
));
$this
->assertRaw($message, t('Product add to cart message displayed.'));
// Go to cart url.
$this
->drupalGet($this
->getCommerceUrl('cart'));
// Test if the page resolves and there is something in the cart.
$this
->assertResponse(200);
$this
->assertNoText(t('Your shopping cart is empty.'), t('Cart is not empty'));
$this
->assertText($this->product_titles[1], t('Product was added to the cart'));
}