public function CheckoutTest::testGuestAuthorizeNetPayment in Commerce Authorize.Net 8
Tests than an order can go through checkout steps.
@group guest
File
- tests/
src/ FunctionalJavascript/ CheckoutTest.php, line 91
Class
- CheckoutTest
- Tests the Authorize.net payment configuration form.
Namespace
Drupal\Tests\commerce_authnet\FunctionalJavascriptCode
public function testGuestAuthorizeNetPayment() {
$this
->drupalLogout();
$this
->drupalGet($this->product
->toUrl()
->toString());
$this
->submitForm([], 'Add to cart');
$this
->drupalGet(Url::fromRoute('commerce_cart.page'));
$this
->submitForm([], 'Checkout');
$this
->assertSession()
->pageTextNotContains('Order Summary');
$this
->submitForm([], 'Continue as Guest');
$this
->submitForm([
'contact_information[email]' => 'guest@example.com',
'contact_information[email_confirm]' => 'guest@example.com',
'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('Please provide valid credit card number.');
// $this->getSession()->getPage()->fillField('payment_information[add_payment_method][payment_details][credit_card_number]', '4111111111111111');
// $this->submitForm([], 'Continue to review');
// $this->assertSession()->pageTextContains('Contact information');
// $this->assertSession()->pageTextContains('guest@example.com');
// $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.');
}