public function CheckoutTest::testRegisteredAuthorizeNetPayment in Commerce Authorize.Net 8
Tests than an order can go through checkout steps.
@group registered
File
- tests/
src/ FunctionalJavascript/ CheckoutTest.php, line 133
Class
- CheckoutTest
- Tests the Authorize.net payment configuration form.
Namespace
Drupal\Tests\commerce_authnet\FunctionalJavascriptCode
public function testRegisteredAuthorizeNetPayment() {
$this
->drupalGet($this->product
->toUrl()
->toString());
$this
->submitForm([], 'Add to cart');
$cart_link = $this
->getSession()
->getPage()
->findLink('your cart');
$cart_link
->click();
$this
->submitForm([], 'Checkout');
$this
->assertSession()
->pageTextContains('Order Summary');
$this
->submitForm([
'payment_information[add_payment_method][payment_details][number]' => '4111111111111111',
'payment_information[add_payment_method][payment_details][expiration][month]' => '02',
'payment_information[add_payment_method][payment_details][expiration][year]' => '27',
'payment_information[add_payment_method][payment_details][security_code]' => '123',
'payment_information[add_payment_method][billing_information][address][0][address][given_name]' => 'Johnny',
'payment_information[add_payment_method][billing_information][address][0][address][family_name]' => 'Appleseed',
'payment_information[add_payment_method][billing_information][address][0][address][address_line1]' => '123 New York Drive',
'payment_information[add_payment_method][billing_information][address][0][address][locality]' => 'New York City',
'payment_information[add_payment_method][billing_information][address][0][address][administrative_area]' => 'NY',
'payment_information[add_payment_method][billing_information][address][0][address][postal_code]' => '10001',
], 'Continue to review');
// @todo We cannot fully test without an HTTPS connection.
// $this->assertSession()->pageTextContains('Contact information');
// $this->assertSession()->pageTextContains($this->loggedInUser->getEmail());
// $this->assertSession()->pageTextContains('Payment information');
// $this->assertSession()->pageTextContains('Visa ending in 1111');
// $this->assertSession()->pageTextContains('Expires 2/2027');
// $this->assertSession()->pageTextContains('Order Summary');
// $this->submitForm([], 'Pay and complete purchase');
// $this->assertSession()->pageTextContains('Your order number is 1. You can view your order on your account page when logged in.');
$this
->assertSession()
->pageTextContains('A HTTPS connection is required.');
}