Ejegg has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/274505

Change subject: Make PayPal tests less tautological
......................................................................

Make PayPal tests less tautological

Set another global, indicate expected return urls.

Also fix language provider for CA

Change-Id: I71b9a5a22cdfeff5213aa9246150869db69ed992
---
M tests/Adapter/PayPal/PayPalTest.php
1 file changed, 15 insertions(+), 14 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface 
refs/changes/05/274505/1

diff --git a/tests/Adapter/PayPal/PayPalTest.php 
b/tests/Adapter/PayPal/PayPalTest.php
index a6dd8b1..e6db707 100644
--- a/tests/Adapter/PayPal/PayPalTest.php
+++ b/tests/Adapter/PayPal/PayPalTest.php
@@ -41,6 +41,7 @@
                $this->setMwGlobals( array(
                        'wgPaypalGatewayCancelPage' => 
'https://example.com/tryAgain.php',
                        'wgPaypalGatewayEnabled' => true,
+                       'wgDonationInterfaceThankYouPage' => 
'https://example.org/wiki/Thank_You',
                        'wgDonationInterfaceAllowedHtmlForms' => array(
                                'paypal' => array(
                                        'file' => $wgPaypalGatewayHtmlFormDir . 
'/paypal.html',
@@ -84,8 +85,8 @@
                        'no_note' => '0',
                        'custom' => $gateway->getData_Unstaged_Escaped( 
'contribution_tracking_id' ),
                        'lc' => $init['country'], //this works because it's a 
US donor...
-                       'cancel_return' => $gateway->getCancelPage(),
-                       'return' => $gateway->getThankYouPage(),
+                       'cancel_return' => 
'https://example.com/tryAgain.php/en',
+                       'return' => 
'https://example.org/wiki/Thank_You/en?country=US',
                );
 
                $this->assertEquals( $expected, $res, 'Paypal "Donate" 
transaction not constructing the expected redirect URL' );
@@ -118,8 +119,8 @@
                        'p3' => '1', //hard-coded in transaction definition
                        'src' => '1', //hard-coded in transaction definition
                        'srt' => $gateway->getGlobal( 'RecurringLength' ),
-                       'cancel_return' => $gateway->getCancelPage(),
-                       'return' => $gateway->getThankYouPage(),
+                       'cancel_return' => 
'https://example.com/tryAgain.php/en',
+                       'return' => 
'https://example.org/wiki/Thank_You/en?country=US',
                );
 
                $this->assertEquals( $expected, $res, 'Paypal "DonateRecurring" 
transaction not constructing the expected redirect URL' );
@@ -151,8 +152,8 @@
                        'no_note' => '1', //hard-coded in transaction definition
                        'custom' => $gateway->getData_Unstaged_Escaped( 
'contribution_tracking_id' ),
 //                     'lc' => $init['country'], //Apparently, this was 
removed from our implementation, because 'CN' is weird.
-                       'cancel_return' => $gateway->getCancelPage(),
-                       'return' => $gateway->getThankYouPage(),
+                       'cancel_return' => 
'https://example.com/tryAgain.php/en',
+                       'return' => 
'https://example.org/wiki/Thank_You/en?country=US',
                        'no_shipping' => '1', //hard-coded in transaction 
definition
                );
 
@@ -221,9 +222,9 @@
                        'item_number' => 'DONATE',
                        'no_note' => '0',
                        'custom' => $gateway->getData_Unstaged_Escaped( 
'contribution_tracking_id' ),
-                       'lc' => $init['country'], //this works because it's a 
US donor...
-                       'cancel_return' => $gateway->getCancelPage(),
-                       'return' => $gateway->getThankYouPage(),
+                       'lc' => 'BE',
+                       'cancel_return' => 
"https://example.com/tryAgain.php/$language";,
+                       'return' => 
"https://example.org/wiki/Thank_You/$language?country=BE";,
                );
 
                $this->assertEquals( $expected, $res, 'Paypal "Donate" 
transaction not constructing the expected redirect URL' );
@@ -234,7 +235,7 @@
         * Integration test to verify that the Donate transaction works as 
expected
         * in Canada for English and French
         *
-        * @dataProvider belgiumLanguageProvider
+        * @dataProvider canadaLanguageProvider
         */
        function testDoTransactionDonate_CA( $language ) {
                $init = $this->getDonorTestData( 'CA' );
@@ -256,8 +257,8 @@
                        'no_note' => '0',
                        'custom' => $gateway->getData_Unstaged_Escaped( 
'contribution_tracking_id' ),
                        'lc' => 'CA',
-                       'cancel_return' => $gateway->getCancelPage(),
-                       'return' => $gateway->getThankYouPage(),
+                       'cancel_return' => 
"https://example.com/tryAgain.php/$language";,
+                       'return' => 
"https://example.org/wiki/Thank_You/$language?country=CA";,
                );
 
                $this->assertEquals( $expected, $res, 'Paypal "Donate" 
transaction not constructing the expected redirect URL' );
@@ -286,8 +287,8 @@
                        'no_note' => '0',
                        'custom' => $gateway->getData_Unstaged_Escaped( 
'contribution_tracking_id' ),
                        'lc' => 'IT',
-                       'cancel_return' => $gateway->getCancelPage(),
-                       'return' => $gateway->getThankYouPage(),
+                       'cancel_return' => 
'https://example.com/tryAgain.php/it',
+                       'return' => 
'https://example.org/wiki/Thank_You/it?country=IT',
                );
 
                $this->assertEquals( $expected, $res, 'Paypal "Donate" 
transaction not constructing the expected redirect URL' );

-- 
To view, visit https://gerrit.wikimedia.org/r/274505
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I71b9a5a22cdfeff5213aa9246150869db69ed992
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to