You are here

public function ContributionDummyTest::fillCardAndSubmit in Webform CiviCRM Integration 8.5

Fill Card Details and submit.

3 calls to ContributionDummyTest::fillCardAndSubmit()
ContributionDummyTest::testOnePageDonation in tests/src/FunctionalJavascript/ContributionDummyTest.php
Test One-page donation
ContributionDummyTest::testOverThousand in tests/src/FunctionalJavascript/ContributionDummyTest.php
ContributionDummyTest::testSubmitContribution in tests/src/FunctionalJavascript/ContributionDummyTest.php

File

tests/src/FunctionalJavascript/ContributionDummyTest.php, line 264

Class

ContributionDummyTest
Tests submitting a Webform with CiviCRM: Contribution with Line Items and Sales Tax

Namespace

Drupal\Tests\webform_civicrm\FunctionalJavascript

Code

public function fillCardAndSubmit() {

  // Wait for the credit card form to load in.
  $this
    ->assertSession()
    ->waitForField('credit_card_number');
  $this
    ->getSession()
    ->getPage()
    ->fillField('Card Number', '4222222222222220');
  $this
    ->getSession()
    ->getPage()
    ->fillField('Security Code', '123');
  $this
    ->getSession()
    ->getPage()
    ->selectFieldOption('credit_card_exp_date[M]', '11');
  $this_year = date('Y');
  $this
    ->getSession()
    ->getPage()
    ->selectFieldOption('credit_card_exp_date[Y]', $this_year + 1);
  $billingValues = [
    'first_name' => 'Frederick',
    'last_name' => 'Pabst',
    'street_address' => '123 Milwaukee Ave',
    'city' => 'Milwaukee',
    'country' => '1228',
    'state_province' => '1048',
    'postal_code' => '53177',
  ];
  $this
    ->fillBillingFields($billingValues);
  $this
    ->getSession()
    ->getPage()
    ->pressButton('Submit');
  $this
    ->htmlOutput();
  $this
    ->assertPageNoErrorMessages();
  $this
    ->assertSession()
    ->pageTextContains('New submission added to CiviCRM Webform Test.');
}