public function CartTest::testCheckoutButton in Commerce Core 8.2
Tests the Checkout button added by commerce_checkout.
File
- modules/
cart/ tests/ src/ Functional/ CartTest.php, line 156
Class
- CartTest
- Tests the cart page.
Namespace
Drupal\Tests\commerce_cart\FunctionalCode
public function testCheckoutButton() {
$this
->drupalGet('cart');
// Confirm that the "Checkout" button redirects and updates the cart.
$this
->assertSession()
->buttonExists('Checkout');
$values = [
'edit_quantity[0]' => 2,
'edit_quantity[1]' => 3,
];
$this
->submitForm($values, t('Checkout'));
$this
->assertSession()
->addressEquals('checkout/1/order_information');
$this
->assertSession()
->pageTextNotContains(t('Your shopping cart has been updated.'));
$this
->drupalGet('cart');
$this
->assertSession()
->fieldValueEquals('edit-edit-quantity-0', 2);
$this
->assertSession()
->fieldValueEquals('edit-edit-quantity-1', 3);
$this
->assertSession()
->elementTextContains('css', '.order-total-line', 'Total');
$this
->assertSession()
->pageTextContains('$3,048.00');
}