Skip to content

Commit

Permalink
Merge pull request #890 from demeritcowboy/Mm2
Browse files Browse the repository at this point in the history
M is sometimes m
  • Loading branch information
KarinG authored Jul 10, 2023
2 parents 2901956 + d31647e commit 80babb7
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
6 changes: 3 additions & 3 deletions tests/src/FunctionalJavascript/ContributionIatsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public function testSubmitContribution() {
$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->getSession()->getPage()->selectFieldOption($this->getCreditCardMonthFieldName(), '11');
$this_year = date('Y');
$this->getSession()->getPage()->selectFieldOption('credit_card_exp_date[Y]', $this_year + 1);
$billingValues = [
Expand Down Expand Up @@ -463,7 +463,7 @@ public function testSubmitRecurringContribution() {
$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->getSession()->getPage()->selectFieldOption($this->getCreditCardMonthFieldName(), '11');
$this_year = date('Y');
$this->getSession()->getPage()->selectFieldOption('credit_card_exp_date[Y]', $this_year + 1);
$billingValues = [
Expand Down Expand Up @@ -529,7 +529,7 @@ public function testSubmitRecurringContribution() {
$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->getSession()->getPage()->selectFieldOption($this->getCreditCardMonthFieldName(), '11');
$this_year = date('Y');
$this->getSession()->getPage()->selectFieldOption('credit_card_exp_date[Y]', $this_year + 1);
$billingValues = [
Expand Down
2 changes: 1 addition & 1 deletion tests/src/FunctionalJavascript/EventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ function testSubmitEventParticipant() {
$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->getSession()->getPage()->selectFieldOption($this->getCreditCardMonthFieldName(), '11');
$this_year = date('Y');
$this->getSession()->getPage()->selectFieldOption('credit_card_exp_date[Y]', $this_year + 1);
$billingValues = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function testSubmitMembershipAutoRenew() {
$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->getSession()->getPage()->selectFieldOption($this->getCreditCardMonthFieldName(), '11');
$this_year = date('Y');
$this->getSession()->getPage()->selectFieldOption('credit_card_exp_date[Y]', $this_year + 1);
$billingValues = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function testAnonymousSubmitWithContribution() {

$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->getSession()->getPage()->selectFieldOption($this->getCreditCardMonthFieldName(), '11');
$this_year = date('Y');
$this->getSession()->getPage()->selectFieldOption('credit_card_exp_date[Y]', $this_year + 1);
$this->getSession()->getPage()->pressButton('Submit');
Expand Down
12 changes: 11 additions & 1 deletion tests/src/FunctionalJavascript/WebformCivicrmTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ protected function fillCardAndSubmit($billingValues = []) {
$this->assertSession()->waitForField('credit_card_number');
$this->getSession()->getPage()->fillField('credit_card_number', '4222222222222220');
$this->getSession()->getPage()->fillField('cvv2', '123');
$this->getSession()->getPage()->selectFieldOption('credit_card_exp_date[m]', '11');
$this->getSession()->getPage()->selectFieldOption($this->getCreditCardMonthFieldName(), '11');
$this_year = date('Y');
$this->getSession()->getPage()->selectFieldOption('credit_card_exp_date[Y]', $this_year + 1);

Expand Down Expand Up @@ -804,4 +804,14 @@ protected function getLastSubmissionId(WebformInterface $webform) {
return reset($submission_ids);
}

/**
* Can remove this once only testing 5.65+
*/
private function getCreditCardMonthFieldName(): string {
if (version_compare(\CRM_Core_BAO_Domain::version(), '5.65.alpha1', '<')) {
return 'credit_card_exp_date[M]';
}
return 'credit_card_exp_date[m]';
}

}

0 comments on commit 80babb7

Please sign in to comment.