public function CartCheckoutTest::testCustomerInformationCheckoutPane in Ubercart 8.4
Tests functioning of customer information pane on checkout page.
File
- uc_cart/
tests/ src/ Functional/ CartCheckoutTest.php, line 674
Class
- CartCheckoutTest
- Tests the cart and checkout functionality.
Namespace
Drupal\Tests\uc_cart\FunctionalCode
public function testCustomerInformationCheckoutPane() {
/** @var \Drupal\Tests\WebAssert $assert */
$assert = $this
->assertSession();
// Log in as a customer and add an item to the cart.
$this
->drupalLogin($this->customer);
$this
->addToCart($this->product);
$this
->drupalGet('cart');
$this
->submitForm([], 'Checkout');
// Test the customer information pane.
$mail = $this->customer
->getEmail();
$assert
->pageTextContains('Customer information');
$assert
->pageTextContains('Order information will be sent to your account e-mail listed below.');
$assert
->pageTextContains('E-mail address: ' . $mail);
// Use the 'edit' link to change the email address on the account.
$new_mail = $this
->randomMachineName() . '@example.com';
$this
->clickLink('edit');
$data = [
'current_pass' => $this->customer->pass_raw,
'mail' => $new_mail,
];
$this
->submitForm($data, 'Save');
// Test the updated email address.
$assert
->pageTextContains('Order information will be sent to your account e-mail listed below.');
$assert
->pageTextNotContains('E-mail address: ' . $mail);
$assert
->pageTextContains('E-mail address: ' . $new_mail);
}