jenkins-bot has submitted this change and it was merged.
Change subject: Test Amazon error form shown and return URI parsed
......................................................................
Test Amazon error form shown and return URI parsed
Gateway should show error form instead of redirect if the data
is fishy. On return, gateway should parse some stuff out of
the URI to feed to Stomp.
Change-Id: I58650735c40e27fa58b6ef7483dfa8ea3e7a4fa1
---
M tests/Adapter/Amazon/AmazonTestCase.php
M tests/FormChooserTestCase.php
2 files changed, 64 insertions(+), 0 deletions(-)
Approvals:
Awight: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/Adapter/Amazon/AmazonTestCase.php
b/tests/Adapter/Amazon/AmazonTestCase.php
index a156acb..178b82f 100644
--- a/tests/Adapter/Amazon/AmazonTestCase.php
+++ b/tests/Adapter/Amazon/AmazonTestCase.php
@@ -95,4 +95,60 @@
$this->assertEquals( $expected, $ret, 'Amazon "DonateMonthly"
transaction not building the expected request params' );
}
+ /**
+ * Verify that the Amazon adapter populates return data from URI.
+ */
+ function testAmazonGatewayReturn() {
+ $url_vars = array (
+ 'transactionAmount' => 'USD 123',
+ 'buyerEmail' => '[email protected]',
+ 'transactionDate' => '2014-07-13',
+ 'buyerName' => 'Suzy Greenberg',
+ 'paymentMethod' => 'Credit Card',
+ 'referenceId' => '12345',
+ );
+ $fake_request = new TestingRequest( $url_vars, false );
+ $this->setMwGlobals( array ( 'wgRequest' => $fake_request ) );
+
+ $init = $this->getDonorTestData();
+ $gateway = $this->getFreshGatewayObject( $init );
+
+ $gateway->do_transaction( 'ProcessAmazonReturn' );
+ $ret = $gateway->getData_Unstaged_Escaped();
+
+ $expected = array (
+ 'currency_code' => 'USD',
+ 'amount' => '123.00',
+ 'email' => '[email protected]',
+ 'fname' => 'Suzy',
+ 'lname' => 'Greenberg',
+ 'payment_submethod' => 'amazon_cc',
+ 'contribution_tracking_id' => '12345',
+ 'date_collect' => '2014-07-13',
+ );
+
+ foreach ($expected as $key => $value) {
+ $this->assertEquals( $value, $ret[$key], 'Amazon
"ProcessAmazonReturn" transaction not populating data from the URI as expected'
);
+ }
+ }
+
+ /**
+ * Integration test to verify that the Amazon gateway shows an error
message when validation fails.
+ */
+ function testShowFormOnError() {
+ $init = $this->getDonorTestData();
+ $init['OTT'] = 'SALT123456789';
+ $init['amount'] = '-100.00';
+ $init['ffname'] = 'amazon';
+ $_SESSION['Donor'] = $init;
+ $errorMessage =
wfMessage('donate_interface-error-msg-field-correction',
wfMessage('donate_interface-error-msg-amount')->text())->text();
+ $assertNodes = array(
+ 'mw-content-text' => array(
+ 'innerhtmlmatches' => "/.*$errorMessage.*/"
+ )
+ );
+
+ $this->verifyFormOutput( 'AmazonGateway', $init, $assertNodes,
false );
+ }
+
}
diff --git a/tests/FormChooserTestCase.php b/tests/FormChooserTestCase.php
index 4516580..a2abef9 100644
--- a/tests/FormChooserTestCase.php
+++ b/tests/FormChooserTestCase.php
@@ -54,6 +54,14 @@
);
$moreForms = array ( );
+
+ $moreForms['amazon'] = array(
+ 'file' => $form_dirs['amazon'] . '/amazon.html',
+ 'gateway' => 'amazon',
+ 'payment_methods' => array( 'amazon' => 'ALL' ),
+ 'redirect',
+ );
+
$moreForms['cc-vmad'] = array (
'file' => $form_dirs['gc'] . '/cc/cc-vmad.html',
'gateway' => 'globalcollect',
--
To view, visit https://gerrit.wikimedia.org/r/147158
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I58650735c40e27fa58b6ef7483dfa8ea3e7a4fa1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: Katie Horn <[email protected]>
Gerrit-Reviewer: Mwalker <[email protected]>
Gerrit-Reviewer: Ssmith <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits