Ejegg has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/350647 )
Change subject: Test with real form settings
......................................................................
Test with real form settings
They used to be included from LocalSettings.php, but now they're
distributed as part of DonationInterface. Make sure they aren't
totally broken.
Change-Id: Iab724418459fbc1e6f7f6d4b41e041aad9fca6af
---
M tests/phpunit/FormChooserTest.php
M tests/phpunit/TestConfiguration.php
2 files changed, 13 insertions(+), 87 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface
refs/changes/47/350647/1
diff --git a/tests/phpunit/FormChooserTest.php
b/tests/phpunit/FormChooserTest.php
index b7fe356..fb09e28 100644
--- a/tests/phpunit/FormChooserTest.php
+++ b/tests/phpunit/FormChooserTest.php
@@ -43,88 +43,6 @@
'wgGlobalCollectGatewayEnabled' => true,
'wgPaypalGatewayEnabled' => true,
) );
-
- $this->setupMoreForms();
- }
-
- public function setupMoreForms() {
- global $wgDonationInterfaceAllowedHtmlForms;
-
- $moreForms = array ( );
-
- $moreForms['amazon'] = array(
- 'gateway' => 'amazon',
- 'payment_methods' => array( 'amazon' => 'ALL' ),
- 'redirect',
- );
-
- $moreForms['cc-vmad'] = array (
- 'gateway' => 'globalcollect',
- 'payment_methods' => array ( 'cc' => array ( 'visa',
'mc', 'amex', 'discover' ) ),
- 'countries' => array (
- '+' => array ( 'US', ),
- ),
- );
-
- $moreForms['cc-vmaj'] = array (
- 'gateway' => 'globalcollect',
- 'payment_methods' => array ( 'cc' => array ( 'visa',
'mc', 'amex', 'jcb' ) ),
- 'countries' => array (
- '+' => array ( 'AD', 'AT', 'AU', 'BE', 'BH',
'DE', 'EC', 'ES', 'FI', 'FR', 'GB',
- 'GF', 'GR', 'HK', 'IE', 'IT', 'JP',
'KR', 'LU', 'MY', 'NL', 'PR',
- 'PT', 'SG', 'SI', 'SK', 'TH', 'TW', ),
- ),
- );
-
- $moreForms['cc-vma'] = array (
- 'gateway' => 'globalcollect',
- 'payment_methods' => array ( 'cc' => array ( 'visa',
'mc', 'amex' ) ),
- 'countries' => array (
- // Array merge with cc-vmaj as fallback in case
'j' goes down
- // Array merge with cc-vmad as fallback in case
'd' goes down
- '+' => array_merge(
-
$moreForms['cc-vmaj']['countries']['+'],
$moreForms['cc-vmad']['countries']['+'], array ( 'AE', 'AL', 'AN', 'AR', 'BG',
'CA', 'CH', 'CN', 'CR', 'CY', 'CZ', 'DK',
- 'DZ', 'EE', 'EG', 'JO', 'KE', 'HR',
'HU', 'IL', 'KW', 'KZ', 'LB', 'LI',
- 'LK', 'LT', 'LV', 'MA', 'MT', 'NO',
'NZ', 'OM', 'PK', 'PL', 'QA', 'RO',
- 'RU', 'SA', 'SE', 'TN', 'TR', 'UA', )
- )
- ),
- );
-
- $moreForms['cc'] = array (
- 'gateway' => 'globalcollect',
- 'payment_methods' => array ( 'cc' => 'ALL' ),
- 'countries' => array ( '-' => 'VN' )
- );
-
- $moreForms['rtbt-ideal'] = array (
- 'gateway' => 'globalcollect',
- 'payment_methods' => array ( 'rtbt' => 'rtbt_ideal' ),
- 'countries' => array ( '+' => 'NL' ),
- 'currencies' => array ( '+' => 'EUR' ),
- );
-
- $moreForms['rtbt-sofo'] = array(
- 'gateway' => 'globalcollect',
- 'countries' => array(
- '+' => array( 'AT', 'BE', 'CH', 'DE' ),
- '-' => 'GB'
- ),
- 'currencies' => array( '+' => 'EUR' ),
- 'payment_methods' => array('rtbt' =>
'rtbt_sofortuberweisung'),
- );
-
- $moreForms['paypal'] = array (
- 'gateway' => 'paypal',
- 'payment_methods' => array ( 'paypal' => 'ALL' ),
- );
-
- $this->setMwGlobals( array(
- 'wgDonationInterfaceAllowedHtmlForms' => array_merge(
- $wgDonationInterfaceAllowedHtmlForms,
- $moreForms
- ),
- ) );
}
function testGetOneValidForm_CC_SpecificCountry() {
@@ -190,6 +108,19 @@
);
$this->verifyFormOutput( 'GatewayFormChooser', $initial,
$assertNodes, false );
}
+
+ /**
+ * Make sure none of the payment form settings are horribly broken.
+ */
+ function testBuildAllFormUrls() {
+ global $wgDonationInterfaceAllowedHtmlForms;
+ foreach ( $wgDonationInterfaceAllowedHtmlForms as $ffname =>
$config ) {
+ if ( empty( $config['special_type'] ) ||
$config['special_type'] != 'error' ) {
+ $url =
GatewayFormChooser::buildPaymentsFormURL( $ffname );
+ $this->assertNotNull( $url );
+ }
+ }
+ }
}
diff --git a/tests/phpunit/TestConfiguration.php
b/tests/phpunit/TestConfiguration.php
index 958dd9f..92fe8e9 100644
--- a/tests/phpunit/TestConfiguration.php
+++ b/tests/phpunit/TestConfiguration.php
@@ -91,11 +91,6 @@
$wgDonationInterfaceTestMode = true;
$wgDonationInterfaceMerchantID = 'test';
-$wgDonationInterfaceAllowedHtmlForms = array(
- 'test' => array(
- ),
-);
-
$wgDonationInterfaceThankYouPage =
'https://wikimediafoundation.org/wiki/Thank_You';
--
To view, visit https://gerrit.wikimedia.org/r/350647
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iab724418459fbc1e6f7f6d4b41e041aad9fca6af
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