jenkins-bot has submitted this change and it was merged.
Change subject: Fix bug so we use invalid amount error
......................................................................
Fix bug so we use invalid amount error
Its message key doesn't have -calc on the end of it.
Bug: T129277
Change-Id: I2a0c3d593375fadf082b6ea57ad0763e68161747
---
M gateway_common/DataValidator.php
M tests/Adapter/Amazon/AmazonTest.php
M tests/Adapter/PayPal/PayPalTest.php
3 files changed, 9 insertions(+), 10 deletions(-)
Approvals:
Cdentinger: Looks good to me, approved
jenkins-bot: Verified
diff --git a/gateway_common/DataValidator.php b/gateway_common/DataValidator.php
index eae19b1..f371287 100644
--- a/gateway_common/DataValidator.php
+++ b/gateway_common/DataValidator.php
@@ -145,18 +145,17 @@
//getErrorToken is actually for something entirely
different:
//Figuring out where on the form the error should land.
$token = self::getErrorToken( $field );
- $suffix = $token; //defaultness
- switch ($token){
- case 'amount':
- $suffix = 'invalid-amount';
+ switch ( $token ) {
+ case 'amount':
+ $error_key_calc =
'donate_interface-error-msg-invalid-amount';
+ break;
+ default:
+ $error_key_calc =
'donate_interface-error-msg-' . $token . '-calc';
break;
}
- $error_key_calc = 'donate_interface-error-msg-' .
$suffix . '-calc';
-
- if ( $type === 'calculated'){
+ if ( $type === 'calculated' ){
// try for the special "calculated" error
message.
- // Note: currently only used for country
if ( MessageUtils::messageExists(
$error_key_calc, $language ) ) {
return WmfFramework::formatMessage(
$error_key_calc );
}
diff --git a/tests/Adapter/Amazon/AmazonTest.php
b/tests/Adapter/Amazon/AmazonTest.php
index e8ee6d8..2e08b90 100644
--- a/tests/Adapter/Amazon/AmazonTest.php
+++ b/tests/Adapter/Amazon/AmazonTest.php
@@ -115,7 +115,7 @@
$init['amount'] = '-100.00';
$init['ffname'] = 'amazon';
$session = array( 'Donor' => $init );
- $errorMessage =
wfMessage('donate_interface-error-msg-field-correction',
wfMessage('donate_interface-error-msg-amount')->text())->text();
+ $errorMessage = wfMessage(
'donate_interface-error-msg-invalid-amount' )->text();
$assertNodes = array(
'mw-content-text' => array(
'innerhtmlmatches' => "/.*$errorMessage.*/"
diff --git a/tests/Adapter/PayPal/PayPalTest.php
b/tests/Adapter/PayPal/PayPalTest.php
index e6db707..c0d526e 100644
--- a/tests/Adapter/PayPal/PayPalTest.php
+++ b/tests/Adapter/PayPal/PayPalTest.php
@@ -188,7 +188,7 @@
$init = $this->getDonorTestData();
$init['amount'] = '-100.00';
$session = array( 'Donor' => $init );
- $errorMessage =
wfMessage('donate_interface-error-msg-field-correction',
wfMessage('donate_interface-error-msg-amount')->text())->text();
+ $errorMessage = wfMessage(
'donate_interface-error-msg-invalid-amount' )->text();
$assertNodes = array(
'mw-content-text' => array(
'innerhtmlmatches' => "/.*$errorMessage.*/"
--
To view, visit https://gerrit.wikimedia.org/r/276014
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I2a0c3d593375fadf082b6ea57ad0763e68161747
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
Gerrit-Reviewer: AndyRussG <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: Cdentinger <[email protected]>
Gerrit-Reviewer: Ssmith <[email protected]>
Gerrit-Reviewer: XenoRyet <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits