Awight has uploaded a new change for review.
https://gerrit.wikimedia.org/r/187590
Change subject: Merge master into deployment
......................................................................
Merge master into deployment
Conflicts:
DonationInterface.php
gateway_common/i18n/interface/diq.json
gateway_common/i18n/interface/fr.json
gateway_common/i18n/interface/ia.json
globalcollect_gateway/forms/css/gc.css
globalcollect_gateway/forms/html/ew/ew-alipay.html
modules/css/gateway.css
payflowpro_gateway/i18n/fr.json
payflowpro_gateway/i18n/sv.json
payflowpro_gateway/i18n/zh-hant.json
tests/DonationDataTest.php
tests/DonationInterfaceTestCase.php
tests/GatewayPageTest.php
tests/TestConfiguration.php
tests/includes/test_page/TestingGlobalCollectGateway.php
tests/macros/suite-all-payment-gateways.htm
Change-Id: If735fa500c3cdd981a1e9510114ef0c040de183e
---
M DonationInterface.php
M gateway_common/i18n/interface/diq.json
M gateway_common/i18n/interface/fr.json
M gateway_common/i18n/interface/ia.json
M globalcollect_gateway/forms/css/gc.css
M globalcollect_gateway/forms/html/ew/ew-alipay.html
M modules/css/gateway.css
D payflowpro_gateway/i18n/fr.json
D payflowpro_gateway/i18n/sv.json
D payflowpro_gateway/i18n/zh-hant.json
D tests/DonationDataTest.php
D tests/DonationInterfaceTestCase.php
D tests/GatewayPageTest.php
D tests/GatewayValidationTest.php
D tests/TestConfiguration.php
D tests/includes/TestingGatewayPage.php
D tests/includes/test_gateway/TestingAdyenAdapter.php
D tests/includes/test_gateway/TestingAmazonAdapter.php
D tests/includes/test_gateway/TestingGenericAdapter.php
D tests/includes/test_gateway/TestingGlobalCollectAdapter.php
D tests/includes/test_gateway/TestingGlobalCollectOrphanAdapter.php
D tests/includes/test_gateway/TestingPaypalAdapter.php
D tests/includes/test_gateway/TestingWorldPayAdapter.php
D tests/includes/test_page/TestingAmazonGateway.php
D tests/includes/test_page/TestingGlobalCollectGateway.php
D tests/includes/test_page/TestingWorldPayGateway.php
D tests/macros/suite-all-payment-gateways.htm
27 files changed, 10 insertions(+), 2,541 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface
refs/changes/90/187590/1
diff --git a/DonationInterface.php b/DonationInterface.php
index 1eb62f1..1286b5a 100644
--- a/DonationInterface.php
+++ b/DonationInterface.php
@@ -1018,8 +1018,6 @@
if ($optionalParts['Stomp'] === true){
require_once( $donationinterface_dir .
'activemq_stomp/activemq_stomp.php' );
$wgAutoloadClasses['Stomp'] = $donationinterface_dir .
'activemq_stomp/Stomp.php';
-<<<<<<< HEAD (aaa30f Annotation in generated forms links to source file)
-=======
}
function efDonationInterfaceUnitTests( &$files ) {
@@ -1031,23 +1029,21 @@
$wgAutoloadClasses['DonationInterfaceTestCase'] = $testDir .
'DonationInterfaceTestCase.php';
- $wgAutoloadClasses['TestingAdyenAdapter'] = $testDir .
'includes/test_gateway/TestingAdyenAdapter.php';
- $wgAutoloadClasses['TestingAmazonAdapter'] = $testDir .
'includes/test_gateway/TestingAmazonAdapter.php';
- $wgAutoloadClasses['TestingAmazonGateway'] = $testDir .
'includes/test_page/TestingAmazonGateway.php';
- $wgAutoloadClasses['TestingGatewayPage'] = $testDir .
'includes/TestingGatewayPage.php';
- $wgAutoloadClasses['TestingGenericAdapter'] = $testDir .
'includes/test_gateway/TestingGenericAdapter.php';
- $wgAutoloadClasses['TestingGlobalCollectAdapter'] = $testDir .
'includes/test_gateway/TestingGlobalCollectAdapter.php';
- $wgAutoloadClasses['TestingGlobalCollectGateway'] = $testDir .
'includes/test_page/TestingGlobalCollectGateway.php';
- $wgAutoloadClasses['TestingGlobalCollectOrphanAdapter'] = $testDir .
'includes/test_gateway/TestingGlobalCollectOrphanAdapter.php';
- $wgAutoloadClasses['TestingPaypalAdapter'] = $testDir .
'includes/test_gateway/TestingPaypalAdapter.php';
- $wgAutoloadClasses['TestingWorldPayAdapter'] = $testDir .
'includes/test_gateway/TestingWorldPayAdapter.php';
- $wgAutoloadClasses['TestingWorldPayGateway'] = $testDir .
'includes/test_page/TestingWorldPayGateway.php';
+ $wgAutoloadClasses['TestingAdyenAdapter'] = $testDir .
'includes/test_gateway/test.adapter.php';
+ $wgAutoloadClasses['TestingAmazonAdapter'] = $testDir .
'includes/test_gateway/test.adapter.php';
+ $wgAutoloadClasses['TestingAmazonGateway'] = $testDir .
'includes/test_page/test.gateway.pages.php';
+ $wgAutoloadClasses['TestingGenericAdapter'] = $testDir .
'includes/test_gateway/test.adapter.php';
+ $wgAutoloadClasses['TestingGlobalCollectAdapter'] = $testDir .
'includes/test_gateway/test.adapter.php';
+ $wgAutoloadClasses['TestingGlobalCollectGateway'] = $testDir .
'includes/test_page/test.gateway.pages.php';
+ $wgAutoloadClasses['TestingGlobalCollectOrphanAdapter'] = $testDir .
'includes/test_gateway/test.adapter.php';
+ $wgAutoloadClasses['TestingPaypalAdapter'] = $testDir .
'includes/test_gateway/test.adapter.php';
+ $wgAutoloadClasses['TestingWorldPayAdapter'] = $testDir .
'includes/test_gateway/test.adapter.php';
+ $wgAutoloadClasses['TestingWorldPayGateway'] = $testDir .
'includes/test_page/test.gateway.pages.php';
$wgAutoloadClasses['TestingLanguage'] = $testDir .
'includes/test_language/test.language.php';
$wgAutoloadClasses['TestingRequest'] = $testDir .
'includes/test_request/test.request.php';
return true;
->>>>>>> BRANCH (fd2ed8 Merge "Fix form width for consistent cross-device
display")
}
unset( $optionalParts );
diff --git a/gateway_common/i18n/interface/diq.json
b/gateway_common/i18n/interface/diq.json
index 9c97974..975f513 100644
--- a/gateway_common/i18n/interface/diq.json
+++ b/gateway_common/i18n/interface/diq.json
@@ -173,10 +173,6 @@
"donate_interface-problemsdonating": "Problemê bêcdayış?",
"donate_interface-donate-click": "Kerta şıma Kredi / banka usul dê
emelina do bıkariyo.",
"donate_interface-otherways-short": "Qan dê bêcer zewbi ray",
-<<<<<<< HEAD (aaa30f Annotation in generated forms links to source file)
- "donate_interface-paypal": "PayPal hesabê şıma esto? <a
href=\"$1/index.php/Special:PayflowProGateway?_cache_=true&paypal=true&masthead=none&form_name=$2&text_template=2010/JimmyAppealLong&language=en&utm_source=$3&utm_medium=$4&utm_campaign=$5\">PayPal
ya bêc bıdê</a>.",
-=======
->>>>>>> BRANCH (fd2ed8 Merge "Fix form width for consistent cross-device
display")
"donate_interface-comment": "Mışewre",
"donate_interface-first": "Sıfteyên",
"donate_interface-middle": "Dıdınki",
diff --git a/gateway_common/i18n/interface/fr.json
b/gateway_common/i18n/interface/fr.json
index ebf319d..520b54e 100644
--- a/gateway_common/i18n/interface/fr.json
+++ b/gateway_common/i18n/interface/fr.json
@@ -418,11 +418,7 @@
"donate_interface-secureLogo-text": "À propos des certificats SSL",
"donate_interface-error-http-403": "Vous n’avez pas le droit d’accéder
à cette page.",
"apihelp-donate-description": "Cette API vous permettent de faire un
don à la Wikimedia Foundation en utilisant une variété de modes de paiement.",
-<<<<<<< HEAD (aaa30f Annotation in generated forms links to source file)
- "apihelp-donate-param-gateway": "Quelle passerelle de paiement utiliser
— payflowpro, globalcollect, etc.",
-=======
"apihelp-donate-param-gateway": "Quelle passerelle de paiement utiliser
— adyen, globalcollect, etc.",
->>>>>>> BRANCH (fd2ed8 Merge "Fix form width for consistent cross-device
display")
"apihelp-donate-param-amount": "Le montant du don.",
"apihelp-donate-param-currency_code": "Code de devise.",
"apihelp-donate-param-fname": "Prénom",
diff --git a/gateway_common/i18n/interface/ia.json
b/gateway_common/i18n/interface/ia.json
index 28a8cd3..438574b 100644
--- a/gateway_common/i18n/interface/ia.json
+++ b/gateway_common/i18n/interface/ia.json
@@ -210,10 +210,6 @@
"donate_interface-otherways": "Il ha <a
href=\"//wikimediafoundation.org/wiki/Donate/WaysToGive/ia\">altere modos de
donar, como PayPal, cheque o posta</a>.",
"donate_interface-otherways-alt": "Il ha <a
href=\"//wikimediafoundation.org/wiki/Ways_to_Give/en\">altere modos de
donar</a>, como per cheque.",
"donate_interface-otherways-short": "Altere modos de donation",
-<<<<<<< HEAD (aaa30f Annotation in generated forms links to source file)
- "donate_interface-paypal": "Ha un conto de PayPal? <a
href=\"$1/index.php/Special:PayflowProGateway?_cache_=true&paypal=true&masthead=none&form_name=$2&text_template=2010/JimmyAppealLong&language=en&utm_source=$3&utm_medium=$4&utm_campaign=$5\">Donar
con PayPal</a>.",
-=======
->>>>>>> BRANCH (fd2ed8 Merge "Fix form width for consistent cross-device
display")
"donate_interface-token-mismatch": "Tu session ha expirate. Per favor
tenta completar e submitter le formulario de novo.",
"donate_interface-cc-form-header-personal": "Informationes de
facturation",
"donate_interface-cc-form-header-payment": "Informationes de pagamento",
diff --git a/globalcollect_gateway/forms/css/gc.css
b/globalcollect_gateway/forms/css/gc.css
index 59d8082..40229cf 100644
--- a/globalcollect_gateway/forms/css/gc.css
+++ b/globalcollect_gateway/forms/css/gc.css
@@ -176,17 +176,10 @@
div.donor { width: auto !important; }
div.donor { width: 100% !important; }
-<<<<<<< HEAD (aaa30f Annotation in generated forms links to source file)
-#payflow-table-donor input[type="text"],
-#payflow-table-donor input:not([type]),
-#payflow-table-donor input[type="email"],
-#payflow-table-donor select {
-=======
#payment-table-donor input[type="text"],
#payment-table-donor input:not([type]),
#payment-table-donor input[type="email"],
#payment-table-donor select {
->>>>>>> BRANCH (fd2ed8 Merge "Fix form width for consistent cross-device
display")
background-color: #f6f6f6;
padding: 1em !important;
-moz-box-shadow: 0 1px 1px rgba(0,0,0,.2), inset 0 0 0 1px rgba(0,0,0,.1);
@@ -201,28 +194,16 @@
margin-bottom: .2em;
}
-<<<<<<< HEAD (aaa30f Annotation in generated forms links to source file)
-#payflow-table-donor input[type="text"]:hover,
-#payflow-table-donor input[type="email"]:hover,
-#payflow-table-donor select:hover {
-=======
#payment-table-donor input[type="text"]:hover,
#payment-table-donor input[type="email"]:hover,
#payment-table-donor select:hover {
->>>>>>> BRANCH (fd2ed8 Merge "Fix form width for consistent cross-device
display")
background: #003955;
color: #fff;
}
-<<<<<<< HEAD (aaa30f Annotation in generated forms links to source file)
-#payflow-table-donor input[type="text"]:focus,
-#payflow-table-donor input[type="email"]:focus,
-#payflow-table-donor select:focus {
-=======
#payment-table-donor input[type="text"]:focus,
#payment-table-donor input[type="email"]:focus,
#payment-table-donor select:focus {
->>>>>>> BRANCH (fd2ed8 Merge "Fix form width for consistent cross-device
display")
background: #fff;
color: #00476b;
-moz-box-shadow: inset 0 1px 3px rgba(0,0,1,.5), inset 0 0 0 1px
rgba(0,0,0,.1);
diff --git a/globalcollect_gateway/forms/html/ew/ew-alipay.html
b/globalcollect_gateway/forms/html/ew/ew-alipay.html
index 00f2ab9..cbc4397 100644
--- a/globalcollect_gateway/forms/html/ew/ew-alipay.html
+++ b/globalcollect_gateway/forms/html/ew/ew-alipay.html
@@ -20,44 +20,6 @@
<p id="topError"
class="creditcard-error-msg"></p>
<form name="paypalcontribution" method="post"
action="@action">
-<<<<<<< HEAD (aaa30f Annotation in generated forms links to source file)
- <div id="payflowpro_gateway-personal-info">
- <table id="payflow-table-donor">
- <tbody>
- <tr>
- <td>
- <div
id="step1header">
- <h3
class="amount_header">%donate_interface-amount-legend%: <span
id="selected-amount">{% block donation-amount currency_code %}</span></h3>
- </div>
- </td>
- </tr>
- <tr>
- <td>
- <input
class="halfwidth optional" id="fname" name="fname"
title="%donate_interface-donor-fname%" value="@fname"
placeholder="%donate_interface-donor-fname%"/><input class="halfwidth optional"
id="lname" name="lname" title="%donate_interface-donor-lname%" value="@lname"
placeholder="%donate_interface-donor-lname%"/>
- </td>
- </tr>
- {% block optional_email %}
- <tr>
- <td>
- <table style="margin-top: 10px;" >
- <tr><td>
- <div id="bt-continue"
style="margin-top: 7px;"> <input class="btn" id="bt-continueBtn" type="button"
value="%donate_interface-continue%" /></div>
- </td><td>
- <img style="margin-left: 40px;
height:60px;"
src="@script_path/extensions/DonationInterface/gateway_forms/includes/alipay.png"
alt="Alipay">
- </td></tr>
- </table>
- </td>
- </tr>
- <tr>
- <td>
- <div id="payment" class="gainlayout"
style="height: 0;text-align: center;"></div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <input type="hidden" name="gateway"
value="payflowpro" id="gateway" />
-=======
<div id="payment_gateway-personal-info">
<table id="payment-table-donor">
<tbody>
@@ -94,7 +56,6 @@
</table>
</div>
<input type="hidden" name="gateway"
value="globalcollect" id="gateway" />
->>>>>>> BRANCH (fd2ed8 Merge "Fix form width for consistent cross-device
display")
<input type="hidden" name="returnto"
value="Thank_You/en" />
<input type="hidden" value="0"
name="PaypalRedirect" id="PaypalRedirect">
<input type="hidden" value="@amount"
name="amount">
diff --git a/modules/css/gateway.css b/modules/css/gateway.css
index c5a5c3d..a051a2c 100644
--- a/modules/css/gateway.css
+++ b/modules/css/gateway.css
@@ -168,11 +168,7 @@
direction: ltr;
}
-<<<<<<< HEAD (aaa30f Annotation in generated forms links to source file)
-#payflow-table-donor {
-=======
#payment-table-donor {
->>>>>>> BRANCH (fd2ed8 Merge "Fix form width for consistent cross-device
display")
white-space: nowrap;
}
@@ -243,30 +239,6 @@
padding: 1em;
width: inherit;
}
-<<<<<<< HEAD (aaa30f Annotation in generated forms links to source file)
- table#payflow-table-donor {
- width: 100%;
- }
-
- /* Form - Amount/Payment Method */
- #radiobuttons-table-header,
- td.radiobuttons-cell,
- .frequency-options,
- .payment-method-button {
- font-size: 2em;
- }
-
- .radiobuttons-cell {
- padding: 0.5em;
- }
-
- input.payment-method-button {
- padding: 1em;
- }
-
- /* Form - Contact/Donation Info */
- table#payflow-table-donor td {
-=======
table#payment-table-donor {
width: 100%;
}
@@ -289,7 +261,6 @@
/* Form - Contact/Donation Info */
table#payment-table-donor td {
->>>>>>> BRANCH (fd2ed8 Merge "Fix form width for consistent cross-device
display")
padding: 0;
}
td#donate form select,
diff --git a/payflowpro_gateway/i18n/fr.json b/payflowpro_gateway/i18n/fr.json
deleted file mode 100644
index 765ec1a..0000000
--- a/payflowpro_gateway/i18n/fr.json
+++ /dev/null
@@ -1,43 +0,0 @@
-<<<<<<< HEAD (aaa30f Annotation in generated forms links to source file)
-{
- "@metadata": {
- "authors": [
- "Cedric31",
- "Crochet.david",
- "DavidL",
- "Gomoko",
- "Grondin",
- "Hashar",
- "IAlex",
- "Jean-Frédéric",
- "Peter17",
- "PieRRoMaN",
- "Quentinv57",
- "Sherbrooke",
- "Verdy p",
- "Windes"
- ]
- },
- "payflowprogateway": "Faire un don maintenant",
- "payflowpro_gateway-desc": "Traitement de carte de crédit par PayPal
Payflow Pro",
- "payflowpro_gateway-response-0": "Votre transaction a été
approuvée.\nMerci pour votre don !",
- "payflowpro_gateway-response-126": "Votre transaction est en cours
d’approbation.",
- "payflowpro_gateway-response-126-2": "Certaines informations que vous
avez fournies ne correspondent pas au profil de votre carte bancaire, ou bien
vous avez offert un montant très élevée. Pour votre propre sécurité, votre don
est actuellement en cours de vérification, et nous vous préviendrons via
l’adresse de courriel que vous avez fournie si nous ne parvenons à finaliser
votre don. Pour toute question, n’hésitez pas à adresser un courriel à <a
href=\"mailto:[email protected]\">[email protected]</a>. Merci !",
- "payflowpro_gateway-response-12": "Veuillez contacter le fournisseur de
votre carte de crédit pour plus d’informations.",
- "payflowpro_gateway-response-13": "Votre transaction requiert une
autorisation vocale.\nVeuillez nous contacter pour poursuivre votre
transaction.",
- "payflowpro_gateway-response-114": "Veuillez contacter le fournisseur
de votre carte de crédit pour plus d'information.",
- "payflowpro_gateway-response-23": "La date d’expiration de votre numéro
de carte de crédit est incorrecte.",
- "payflowpro_gateway-response-4": "Montant invalide.",
- "payflowpro_gateway-response-24": "Votre numéro de carte de crédit ou
date d'expiration est incorrect(e).",
- "payflowpro_gateway-response-112": "Votre adresse ou numéro CVV (code
de sécurité) est incorrect(e).",
- "payflowpro_gateway-response-125": "Votre transaction a été déclinée
par les Services de prévention des fraudes.",
- "payflowpro_gateway-response-125-2": "Votre carte bancaire n’a pas pu
être validée. Veuillez vérifier que les informations fournies correspondent au
profil de votre carte bancaire, ou essayez avec une autre carte. Vous pouvez
aussi utiliser <a
href=\"//wikimediafoundation.org/wiki/Ways_to_Give/en\">d’autres solutions pour
faire un don</a> ou nous contacter à l’adresse <a
href=\"mailto:[email protected]\">[email protected]</a>. Nous vous
remercions de votre soutien.",
- "payflowpro_gateway-response-default": "Une erreur est survenue lors du
traitement de votre transaction.\nVeuillez réessayer plus tard.",
- "apihelp-pfp-description": "Expose l’interaction de l’API avec
l’extension Passerelle PayflowPro.",
- "apihelp-pfp-param-dispatch": "La méthode de l’API depuis laquelle
renvoyer les données.",
- "apihelp-pfp-param-tracking_data": "Une chaîne de données au format
JSON à insérer dans contribution_tracking.",
- "apihelp-pfp-param-gateway": "La passerelle actuelle.",
- "apihelp-pfp-param-payment_method": "La méthode de paiement actuelle."
-}
-=======
->>>>>>> BRANCH (fd2ed8 Merge "Fix form width for consistent cross-device
display")
diff --git a/payflowpro_gateway/i18n/sv.json b/payflowpro_gateway/i18n/sv.json
deleted file mode 100644
index 6002220..0000000
--- a/payflowpro_gateway/i18n/sv.json
+++ /dev/null
@@ -1,37 +0,0 @@
-<<<<<<< HEAD (aaa30f Annotation in generated forms links to source file)
-{
- "@metadata": {
- "authors": [
- "Ainali",
- "Boivie",
- "Cohan",
- "GameOn",
- "Nghtwlkr",
- "Per",
- "Tobulos1",
- "Lokal Profil"
- ]
- },
- "payflowprogateway": "Donera nu",
- "payflowpro_gateway-desc": "PayPal Payflow Pro kreditkortsbearbetning",
- "payflowpro_gateway-response-0": "Transaktionen har godkänts.\nTack för
din gåva!",
- "payflowpro_gateway-response-126": "Transaktionen väntar på
godkännande.",
- "payflowpro_gateway-response-126-2": "Något av informationen du angav
matchade inte din kreditkortsprofil, eller så gav du en väldigt stor gåva. För
din egen säkerhet så granskas din donation nu, och vi kommer att meddela till
den angivna epost-adressen om vi inte kan slutföra din donation. Vänligen
eposta till <a href=\"mailto:[email protected]\">[email protected]</a> om
du har några frågor. Tack!",
- "payflowpro_gateway-response-12": "Kontakta utställaren av ditt
kreditkort för mer information.",
- "payflowpro_gateway-response-13": "Transaktionen kräver
röstgodkännande.\nKontakta oss för att gå vidare med transaktionen.",
- "payflowpro_gateway-response-114": "Vänligen kontakta utställaren av
ditt kreditkort för mer information.",
- "payflowpro_gateway-response-23": "Ditt kreditkortsnummer eller
utgångsdatum är felaktigt.",
- "payflowpro_gateway-response-4": "Ogiltigt belopp.",
- "payflowpro_gateway-response-24": "Ditt kreditkortsnummer eller
utgångsdatum är felaktigt.",
- "payflowpro_gateway-response-112": "Din adress eller CVV nummer
(säkerhetskod) är felaktig.",
- "payflowpro_gateway-response-125": "Din transaktion har blivit avvisad
av Fraud Prevention Services.",
- "payflowpro_gateway-response-125-2": "Ditt kreditkort kunde inte
godkännas. Vänligen kontrollera att all information stämmer med dina
kreditkortsdata eller prova ett annat kort. Du kan också använda ett av de <a
href=\"http://wikimediafoundation.org/wiki/Ways_to_Give/en\">andra sätt att ge
ett bidrag</a> eller kontakta oss på <a
href=\"mailto:[email protected]\">[email protected]</a>. Tack för att du
stöttar oss.",
- "payflowpro_gateway-response-default": "Ett fel uppstod när din
transaktion behandlades.\nFörsök igen senare.",
- "apihelp-pfp-description": "Visar API-interaktionen med PayflowPro
Gateway-tillägget.",
- "apihelp-pfp-param-dispatch": "Den API-metod för vilken data
returneras.",
- "apihelp-pfp-param-tracking_data": "En JSON-formaterad sträng av data
att infoga i contribution_tracking.",
- "apihelp-pfp-param-gateway": "Den aktuella gatewayen.",
- "apihelp-pfp-param-payment_method": "Den aktuella betalningsmetoden."
-}
-=======
->>>>>>> BRANCH (fd2ed8 Merge "Fix form width for consistent cross-device
display")
diff --git a/payflowpro_gateway/i18n/zh-hant.json
b/payflowpro_gateway/i18n/zh-hant.json
deleted file mode 100644
index 3402b24..0000000
--- a/payflowpro_gateway/i18n/zh-hant.json
+++ /dev/null
@@ -1,32 +0,0 @@
-<<<<<<< HEAD (aaa30f Annotation in generated forms links to source file)
-{
- "@metadata": {
- "authors": [
- "Anakmalaysia",
- "Horacewai2",
- "Liangent",
- "Mark85296341",
- "Pbdragonwang",
- "Waihorace",
- "LNDDYL",
- "Cwlin0416"
- ]
- },
- "payflowprogateway": "現在捐款",
- "payflowpro_gateway-desc": "PayPal Payflow Pro 信用卡處理",
- "payflowpro_gateway-response-0": "您的交易已經成功。\n感謝您的捐助!",
- "payflowpro_gateway-response-126": "您的交易正在等待確認中。",
- "payflowpro_gateway-response-126-2":
"你提供的部份資料可能與你的信用卡資料不符,或者你作出了一個大數量的捐款;為確保你的安全,你的捐款正在審查中,如果你的捐款不成功,我們將會透過你填入的電子郵件通知你。如有查詢,請電子郵件至<a
href=\"mailto:[email protected]\">[email protected]</a>。",
- "payflowpro_gateway-response-12": "請聯絡您的信用卡公司提供進一步資料。",
- "payflowpro_gateway-response-13": "您的交易需要語音授權。\n請聯絡我們以完成您的這筆交易。",
- "payflowpro_gateway-response-114": "請聯絡您的信用卡公司提供進一步資料。",
- "payflowpro_gateway-response-23": "您的信用卡號碼或有效期有誤。",
- "payflowpro_gateway-response-4": "無效的金額。",
- "payflowpro_gateway-response-24": "您的信用卡號或有效期有誤。",
- "payflowpro_gateway-response-112": "您的位址或 CVV 碼 (安全碼) 有誤。",
- "payflowpro_gateway-response-125": "反欺詐系統拒絕了您的捐獻。",
- "payflowpro_gateway-response-125-2":
"您的信用卡無法被驗證。請確保您所提供的資料與信用卡的資料相符,或者換另外一張信用卡再試一次。您可以使用我們其他的<a
href=\"http://wikimediafoundation.org/wiki/Ways_to_Give/en\">捐款方式</a>,或與<a
href=\"mailto:[email protected]\">[email protected]</a>聯絡。再次感謝您的支持。",
- "payflowpro_gateway-response-default": "在處理交易的過程中出錯。\n請稍後再試。"
-}
-=======
->>>>>>> BRANCH (fd2ed8 Merge "Fix form width for consistent cross-device
display")
diff --git a/tests/DonationDataTest.php b/tests/DonationDataTest.php
deleted file mode 100644
index f141ebc..0000000
--- a/tests/DonationDataTest.php
+++ /dev/null
@@ -1,371 +0,0 @@
-<<<<<<< HEAD (aaa30f Annotation in generated forms links to source file)
-=======
-<?php
-/**
- * Wikimedia Foundation
- *
- * LICENSE
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
-
-/**
- * @group Fundraising
- * @group DonationInterface
- * @group Splunge
- */
-class DonationInterface_DonationDataTest extends DonationInterfaceTestCase {
-
- /**
- * @param $name string The name of the test case
- * @param $data array Any parameters read from a dataProvider
- * @param $dataName string|int The name or index of the data set
- */
- public function __construct( $name = null, array $data = array(),
$dataName = '' ) {
- global $wgRequest;
-
- $adapterclass = TESTS_ADAPTER_DEFAULT;
- $this->testAdapterClass = $adapterclass;
-
- parent::__construct( $name, $data, $dataName );
-
- $this->testData = array(
- 'amount' => '128.00',
- 'email' => '[email protected]',
- 'fname' => 'Testocres',
- 'lname' => 'McTestingyou',
- 'street' => '123 Fake Street',
- 'city' => 'Springfield',
- 'state' => 'US',
- 'zip' => '99999',
- 'country' => 'US',
- 'card_num' => '42',
- 'card_type' => 'visa',
- 'expiration' => '1138',
- 'cvv' => '665',
- 'currency_code' => 'USD',
- 'payment_method' => '',
- 'payment_submethod' => '',
- 'numAttempt' => '5',
- 'referrer' => 'http://www.testing.com/',
- 'utm_source' => '..cc',
- 'utm_medium' => 'large',
- 'utm_campaign' => 'yes',
- 'email-opt' => '',
- 'test_string' => '',
- 'token' => '113811',
- 'contribution_tracking_id' => '',
- 'data_hash' => '',
- 'action' => '',
- 'gateway' => 'DonationData',
- 'owa_session' => '',
- 'owa_ref' => 'http://localhost/importedTestData',
- 'user_ip' => $wgRequest->getIP(),
- 'server_ip' => $wgRequest->getIP(),
- );
-
- }
-
-
- /**
- * @covers DonationData::__construct
- * @covers DonationData::getDataEscaped
- * @covers DonationData::populateData
- */
- public function testConstruct(){
- global $wgLanguageCode, $wgRequest;
-
- $ddObj = new DonationData( $this->getFreshGatewayObject(
$this->initial_vars ) ); //as if we were posted.
- $returned = $ddObj->getDataEscaped();
- $expected = array( 'posted' => '',
- 'amount' => '0.00',
- 'email' => '[email protected]',
- 'country' => 'XX',
- 'payment_method' => '',
- 'referrer' => '',
- 'utm_source' => '..cc',
- 'language' => $wgLanguageCode,
- 'gateway' => 'globalcollect',
- 'payment_submethod' => '',
- 'recurring' => '',
- 'user_ip' => $wgRequest->getIP(),
- 'server_ip' => $wgRequest->getIP(),
- );
- unset($returned['contribution_tracking_id']);
- unset($returned['order_id']);
- $this->assertEquals($expected, $returned, "Staged post data
does not match expected (largely empty).");
- }
-
- /**
- * Test construction with external data (for tests and possible batch
operations)
- */
- public function testConstructWithExternalData() {
- global $wgRequest;
-
- $expected = array (
- 'amount' => '35.00',
- 'email' => '[email protected]',
- 'fname' => 'Tester',
- 'lname' => 'Testington',
- 'street' => '548 Market St.',
- 'city' => 'San Francisco',
- 'state' => 'CA',
- 'zip' => '94104',
- 'country' => 'US',
- 'card_num' => '378282246310005',
- 'card_type' => 'american',
- 'expiration' => '0415',
- 'cvv' => '001',
- 'currency_code' => 'USD',
- 'payment_method' => 'cc',
- 'referrer' =>
'http://www.baz.test.com/index.php?action=foo&action=bar',
- 'utm_source' => 'test_src..cc',
- 'utm_medium' => 'test_medium',
- 'utm_campaign' => 'test_campaign',
- 'language' => 'en',
- 'token' => '',
- 'data_hash' => '',
- 'action' => '',
- 'gateway' => 'globalcollect',
- 'owa_session' => '',
- 'owa_ref' => 'http://localhost/defaultTestData',
- 'street_supplemental' => '3rd floor',
- 'payment_submethod' => 'american',
- 'issuer_id' => '',
- 'utm_source_id' => '',
- 'user_ip' => '12.12.12.12',
- 'server_ip' => $wgRequest->getIP(),
- 'recurring' => '',
- );
-
- $ddObj = new DonationData( $this->getFreshGatewayObject(
$this->initial_vars ), $expected ); //external data
- $returned = $ddObj->getDataEscaped();
-
-
- $this->assertNotNull( $returned['contribution_tracking_id'],
'There is no contribution tracking ID' );
- $this->assertNotEquals( $returned['contribution_tracking_id'],
'', 'There is not a valid contribution tracking ID' );
-
- unset($returned['order_id']);
- unset($returned['contribution_tracking_id']);
-
- $this->assertEquals($expected, $returned, "Staged default test
data does not match expected.");
- }
-
- /**
- * Test construction with data jammed in $_GET.
- */
- public function testConstructWithFauxRequest() {
- global $wgRequest;
-
- $expected = array (
- 'amount' => '35.00',
- 'email' => '[email protected]',
- 'fname' => 'Tester',
- 'lname' => 'Testington',
- 'street' => '548 Market St.',
- 'city' => 'San Francisco',
- 'state' => 'CA',
- 'zip' => '94104',
- 'country' => 'US',
- 'card_num' => '378282246310005',
- 'card_type' => 'american',
- 'expiration' => '0415',
- 'cvv' => '001',
- 'currency_code' => 'USD',
- 'payment_method' => 'cc',
- 'referrer' =>
'http://www.baz.test.com/index.php?action=foo&action=bar',
- 'utm_source' => 'test_src..cc',
- 'utm_medium' => 'test_medium',
- 'utm_campaign' => 'test_campaign',
- 'language' => 'en',
- 'gateway' => 'globalcollect',
- 'owa_ref' => 'http://localhost/getTestData',
- 'street_supplemental' => '3rd floor',
- 'payment_submethod' => 'american',
- 'user_ip' => $wgRequest->getIP(),
- 'server_ip' => $wgRequest->getIP(),
- 'recurring' => '',
- 'posted' => '',
- );
-
- $this->setMwGlobals( 'wgRequest', new FauxRequest( $expected,
false ) );
-
- $ddObj = new DonationData( $this->getFreshGatewayObject(
$this->initial_vars ) ); //Get all data from $_GET
- $returned = $ddObj->getDataEscaped();
-
- $this->assertNotNull( $returned['contribution_tracking_id'],
'There is no contribution tracking ID' );
- $this->assertNotEquals( $returned['contribution_tracking_id'],
'', 'There is not a valid contribution tracking ID' );
-
- unset( $returned['order_id'] );
- unset( $returned['contribution_tracking_id'] );
-
- $this->assertEquals( $expected, $returned, "Staged default test
data does not match expected." );
- }
-
- /**
- *
- */
- public function testRepopulate(){
- global $wgLanguageCode;
-
- $expected = $this->testData;
-
- // Some changes from the default
- $expected['recurring'] = '';
- $expected['language'] = $wgLanguageCode;
- $expected['gateway'] = 'globalcollect';
-
- // Just unset a handful... doesn't matter what, really.
- unset($expected['comment-option']);
- unset($expected['email-opt']);
- unset($expected['test_string']);
-
- $ddObj = new DonationData( $this->getFreshGatewayObject(
$this->initial_vars ), $expected ); //change to test mode with explicit test
data
- $returned = $ddObj->getDataEscaped();
- //unset these, because they're always new
- $unsettable = array(
- 'order_id',
- 'contribution_tracking_id'
- );
-
- foreach ( $unsettable as $thing ) {
- unset( $returned[$thing] );
- unset( $expected[$thing] );
- }
-
- $this->assertEquals( $expected, $returned, "The forced test
data did not populate as expected." );
- }
-
- /**
- *
- */
- public function testIsSomething(){
- $data = $this->testData;
- unset( $data['zip'] );
-
- $ddObj = new DonationData( $this->getFreshGatewayObject(
$this->initial_vars ), $data ); //change to test mode with explicit test data
- $this->assertEquals($ddObj->isSomething('zip'), false, "Zip
should currently be nothing.");
- $this->assertEquals($ddObj->isSomething('lname'), true, "Lname
should currently be something.");
- }
-
- /**
- *
- */
- public function testSetNormalizedAmount_amtGiven() {
- $data = $this->testData;
- $data['amount'] = 'this is not a number';
- $data['amountGiven'] = 42.50;
- $ddObj = new DonationData( $this->getFreshGatewayObject(
$this->initial_vars ), $data ); //change to test mode with explicit test data
- $returned = $ddObj->getDataEscaped();
- $this->assertEquals( 42.50, $returned['amount'], "Amount was
not properly reset" );
- $this->assertArrayNotHasKey( 'amountGiven', $returned,
"amountGiven should have been removed from the data" );
- }
-
- /**
- *
- */
- public function testSetNormalizedAmount_amount() {
- $data = $this->testData;
- $data['amount'] = 88.15;
- $data['amountGiven'] = 42.50;
- $ddObj = new DonationData( $this->getFreshGatewayObject(
$this->initial_vars ), $data ); //change to test mode with explicit test data
- $returned = $ddObj->getDataEscaped();
- $this->assertEquals( 88.15, $returned['amount'], "Amount was
not properly reset" );
- $this->assertArrayNotHasKey( 'amountGiven', $returned,
"amountGiven should have been removed from the data" );
- }
-
- /**
- *
- */
- public function testSetNormalizedAmount_negativeAmount() {
- $data = $this->testData;
- $data['amount'] = -1;
- $data['amountOther'] = 3.25;
- $ddObj = new DonationData( $this->getFreshGatewayObject(
$this->initial_vars ), $data ); //change to test mode with explicit test data
- $returned = $ddObj->getDataEscaped();
- $this->assertEquals(3.25, $returned['amount'], "Amount was not
properly reset");
- $this->assertArrayNotHasKey( 'amountOther', $returned,
"amountOther should have been removed from the data");
- }
-
- /**
- *
- */
- public function testSetNormalizedAmount_noGoodAmount() {
- $data = $this->testData;
- $data['amount'] = 'splunge';
- $data['amountGiven'] = 'wombat';
- $data['amountOther'] = 'macedonia';
- $ddObj = new DonationData( $this->getFreshGatewayObject(
$this->initial_vars ), $data ); //change to test mode with explicit test data
- $returned = $ddObj->getDataEscaped();
- $this->assertEquals( 'invalid', $returned['amount'], "Amount
was not properly reset");
- $this->assertArrayNotHasKey( 'amountOther', $returned,
"amountOther should have been removed from the data");
- $this->assertArrayNotHasKey( 'amountGiven', $returned,
"amountGiven should have been removed from the data");
- }
-
- /**
- *
- */
- public function testSetNormalizedLanguage_uselang() {
- $data = $this->testData;
- unset( $data['uselang'] );
- unset( $data['language'] );
-
- $data['uselang'] = 'no';
-
- $ddObj = new DonationData( $this->getFreshGatewayObject(
$this->initial_vars ), $data ); //change to test mode with explicit test data
- $returned = $ddObj->getDataEscaped();
- $this->assertEquals( 'no', $returned['language'], "Language
'no' was normalized out of existance. Sad." );
- $this->assertArrayNotHasKey( 'uselang', $returned, "'uselang'
should have been removed from the data" );
- }
-
- /**
- *
- */
- public function testSetNormalizedLanguage_language() {
- $data = $this->testData;
- unset( $data['uselang'] );
- unset( $data['language'] );
-
- $data['language'] = 'no';
-
- $ddObj = new DonationData( $this->getFreshGatewayObject(
$this->initial_vars ), $data ); //change to test mode with explicit test data
- $returned = $ddObj->getDataEscaped();
- $this->assertEquals( 'no', $returned['language'], "Language
'no' was normalized out of existance. Sad." );
- $this->assertArrayNotHasKey( 'uselang', $returned, "'uselang'
should have been removed from the data" );
- }
-
- /**
- * TODO: Make sure ALL these functions in DonationData are tested,
either directly or through a calling function.
- * I know that's more regression-ish, but I stand by it. :p
- function setNormalizedOrderIDs(){
- function generateOrderId() {
- public function sanitizeInput( &$value, $key, $flags=ENT_COMPAT,
$double_encode=false ) {
- function setGateway(){
- function doCacheStuff(){
- public function getEditToken( $salt = '' ) {
- public static function generateToken( $salt = '' ) {
- function matchEditToken( $val, $salt = '' ) {
- function unsetEditToken() {
- public function checkTokens() {
- function wasPosted(){
- function setUtmSource() {
- public function getOptOuts() {
- public function getCleanTrackingData( $clean_optouts = false ) {
- function saveContributionTracking() {
- public static function insertContributionTracking( $tracking_data ) {
- public function updateContributionTracking( $force = false ) {
-
- */
-}
-
-
->>>>>>> BRANCH (fd2ed8 Merge "Fix form width for consistent cross-device
display")
diff --git a/tests/DonationInterfaceTestCase.php
b/tests/DonationInterfaceTestCase.php
deleted file mode 100644
index 53c3a12..0000000
--- a/tests/DonationInterfaceTestCase.php
+++ /dev/null
@@ -1,626 +0,0 @@
-<<<<<<< HEAD (aaa30f Annotation in generated forms links to source file)
-=======
-<?php
-/**
- * Wikimedia Foundation
- *
- * LICENSE
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
-
-/**
- * @group Fundraising
- * @group QueueHandling
- * @group ClassMethod
- * @group ListenerAdapter
- *
- * @category UnitTesting
- * @package Fundraising_QueueHandling
- */
-abstract class DonationInterfaceTestCase extends MediaWikiTestCase {
- protected $backupGlobalsBlacklist = array(
- 'wgHooks',
- );
-
- /**
- * Returns an array of the vars we expect to be set before people hit
payments.
- * @var array
- */
- public $initial_vars = array (
- 'ffname' => 'testytest',
- 'referrer' => 'www.yourmom.com', //please don't go there.
- 'currency_code' => 'USD',
- );
-
- /**
- * This will be set by a test method with the adapter object.
- *
- * @var GatewayAdapter $gatewayAdapter
- */
- protected $gatewayAdapter;
-
- /**
- * @param $name string The name of the test case
- * @param $data array Any parameters read from a dataProvider
- * @param $dataName string|int The name or index of the data set
- */
- public function __construct( $name = null, array $data = array(),
$dataName = '' ) {
-
- //Just in case you got here without running the configuration...
- global $wgDonationInterfaceTestMode;
- $wgDonationInterfaceTestMode = true;
-
- $adapterclass = TESTS_ADAPTER_DEFAULT;
- $this->testAdapterClass = $adapterclass;
-
- parent::__construct( $name, $data, $dataName );
- }
-
- protected function setUp() {
- parent::setUp();
- }
-
- protected function tearDown() {
- $this->resetAllEnv();
- parent::tearDown();
- }
-
- /**
- * buildRequestXmlForGlobalCollect
- *
- * @todo
- * - there are many cases to this that need to be developed.
- * - Do not consider this a complete test!
- *
- * @covers GatewayAdapter::__construct
- * @covers GatewayAdapter::setCurrentTransaction
- * @covers GatewayAdapter::buildRequestXML
- */
- public function buildRequestXmlForGlobalCollect( $optionsForTestData,
$options ) {
-
- global $wgDonationInterfaceTest;
-
- $wgDonationInterfaceTest = true;
-
- $this->gatewayAdapter = $this->getFreshGatewayObject( $options
);
-
-
$this->gatewayAdapter->setCurrentTransaction('INSERT_ORDERWITHPAYMENT');
-
- $request = trim( $this->gatewayAdapter->_buildRequestXML() );
-
- $expected = $this->getExpectedXmlRequestForGlobalCollect(
$optionsForTestData, $options );
-
- $this->assertEquals( $expected, $request, 'The constructed XML
for payment_method [' . $optionsForTestData['payment_method'] . '] and
payment_submethod [' . $optionsForTestData['payment_submethod'] . '] does not
match our expected request.' );
- }
-
- /**
- *
- * @param string $country The country we want the test user to be from.
- * @return array Donor data to use
- * @throws MWException when there is no data available for the
requested country
- */
- public function getDonorTestData( $country = '' ) {
- $donortestdata = array (
- 'US' => array ( //default
- 'city' => 'San Francisco',
- 'state' => 'CA',
- 'zip' => '94105',
- 'currency_code' => 'USD',
- 'street' => '123 Fake Street',
- 'fname' => 'Firstname',
- 'lname' => 'Surname',
- 'amount' => '1.55',
- 'language' => 'en',
- ),
- 'ES' => array (
- 'city' => 'Barcelona',
- 'state' => 'XX',
- 'zip' => '0',
- 'currency_code' => 'EUR',
- 'street' => '123 Calle Fake',
- 'fname' => 'Nombre',
- 'lname' => 'Apellido',
- 'amount' => '1.55',
- 'language' => 'es',
- ),
- 'NO' => array (
- 'city' => 'Oslo',
- 'state' => 'XX',
- 'zip' => '0',
- 'currency_code' => 'EUR',
- 'street' => '123 Fake Gate',
- 'fname' => 'Fornavn',
- 'lname' => 'Etternavn',
- 'amount' => '1.55',
- 'language' => 'no',
- ),
- 'FR' => array (
- 'city' => 'Versailles',
- 'state' => 'XX',
- 'zip' => '0',
- 'currency_code' => 'EUR',
- 'street' => '123 Rue Faux',
- 'fname' => 'Prénom',
- 'lname' => 'Nom',
- 'amount' => '1.55',
- 'language' => 'fr',
- ),
- // Fiji is configured as a snowflake to test special
treatment for certain store IDs
- 'FJ' => array (
- 'city' => 'Suva',
- 'state' => 'XX',
- 'zip' => '0',
- 'currency_code' => 'EUR',
- 'street' => '123 Fake Street',
- 'fname' => 'FirstName',
- 'lname' => 'LastName',
- 'amount' => '1.55',
- 'language' => 'en',
- ),
- 'NL' => array (
- 'city' => 'Amsterdam',
- 'state' => 'XX',
- 'zip' => '0',
- 'currency_code' => 'EUR',
- 'street' => '123 nep straat',
- 'fname' => 'Voornaam',
- 'lname' => 'Achternaam',
- 'amount' => '1.55',
- 'language' => 'nl',
- ),
- 'BE' => array (
- 'city' => 'Antwerp',
- 'state' => 'XX',
- 'zip' => '0',
- 'currency_code' => 'EUR',
- 'street' => '123 nep straat',
- 'fname' => 'Voornaam',
- 'lname' => 'Achternaam',
- 'amount' => '1.55',
- 'language' => 'nl',
- ),
- 'IT' => array (
- 'city' => 'Torino',
- 'state' => 'TO',
- 'zip' => '10123',
- 'currency_code' => 'EUR',
- 'street' => 'Via Falso 123',
- 'fname' => 'Nome',
- 'lname' => 'Cognome',
- 'amount' => '1.55',
- 'language' => 'it',
- ),
- 'CA' => array (
- 'city' => 'Saskatoon',
- 'state' => 'SK',
- 'zip' => 'S7K 0J5',
- 'currency_code' => 'CAD',
- 'street' => '123 Fake Street',
- 'fname' => 'Firstname',
- 'lname' => 'Surname',
- 'amount' => '1.55',
- 'language' => 'en',
- ),
- );
- //default to US
- if ( $country === '' ) {
- $country = 'US';
- }
-
- if ( array_key_exists( $country, $donortestdata ) ) {
- $donortestdata = array_merge( $this->initial_vars,
$donortestdata[$country] );
- $donortestdata['country'] = $country;
- return $donortestdata;
- }
- throw new MWException( __FUNCTION__ . ": No donor data for
country '$country'" );
- }
-
- /**
- * Supported languages for Belgium
- */
- public function belgiumLanguageProvider() {
- return array(
- array( 'nl' ),
- array( 'de' ),
- array( 'fr' ),
- );
- }
-
- /**
- * Supported languages for Canada
- */
- public function canadaLanguageProvider() {
- return array(
- array( 'en' ),
- array( 'fr' ),
- );
- }
-
- /**
- * Transaction codes for GC and GC orphan adapters not to be retried
- * on pain of $1000+ fines by MasterCard
- */
- public function mcNoRetryCodeProvider() {
- return array(
- array( '430260' ),
- array( '430306' ),
- array( '430330' ),
- array( '430354' ),
- array( '430357' ),
- );
- }
-
- public function benignNoRetryCodeProvider() {
- return array(
- array( '430285' ),
- );
- }
-
- /**
- * Get the expected XML request from GlobalCollect
- *
- * @param $optionsForTestData
- * @param array $options
- * @return string The expected XML request
- */
- public function getExpectedXmlRequestForGlobalCollect(
$optionsForTestData, $options = array() ) {
- global $wgRequest, $wgServer, $wgArticlePath,
$wgDonationInterfaceThankYouPage;
-
- $orderId = $this->gatewayAdapter->getData_Unstaged_Escaped(
'order_id' );
- $merchantref = $this->gatewayAdapter->_getData_Staged(
'contribution_tracking_id' );
- //@TODO: WHY IN THE NAME OF ZARQUON are we building XML in a
STRING format here?!?!?!!!1one1!?. Great galloping galumphing giraffes.
- $expected = '<?xml version="1.0" encoding="UTF-8"?' . ">\n";
- $expected .= '<XML>';
- $expected .= '<REQUEST>';
- $expected .=
'<ACTION>INSERT_ORDERWITHPAYMENT</ACTION>';
- $expected .= '<META><MERCHANTID>' .
$this->gatewayAdapter->getGlobal( 'MerchantID' ) . '</MERCHANTID>';
-
- if ( isset( $wgRequest ) ) {
- $expected .= '<IPADDRESS>' .
$wgRequest->getIP() . '</IPADDRESS>';
- }
-
- $expected .= '<VERSION>1.0</VERSION>';
- $expected .= '</META>';
- $expected .= '<PARAMS>';
- $expected .= '<ORDER>';
- $expected .= '<ORDERID>' . $orderId
. '</ORDERID>';
- $expected .= '<AMOUNT>' .
$options['amount'] * 100 . '</AMOUNT>';
- $expected .= '<CURRENCYCODE>' .
$options['currency_code'] . '</CURRENCYCODE>';
- $expected .= '<LANGUAGECODE>' .
$options['language'] . '</LANGUAGECODE>';
- $expected .= '<COUNTRYCODE>' .
$options['country'] . '</COUNTRYCODE>';
- $expected .= '<MERCHANTREFERENCE>' . $merchantref .
'</MERCHANTREFERENCE>';
-
- if ( isset( $wgRequest ) ) {
- $expected .= '<IPADDRESSCUSTOMER>' .
$wgRequest->getIP() . '</IPADDRESSCUSTOMER>';
- }
-
- $expected .= '<EMAIL>' . TESTS_EMAIL
. '</EMAIL>';
- $expected .= '</ORDER>';
- $expected .= '<PAYMENT>';
- $expected .= '<PAYMENTPRODUCTID>' .
$optionsForTestData['payment_product_id'] . '</PAYMENTPRODUCTID>';
- $expected .= '<AMOUNT>' .
$options['amount'] * 100 . '</AMOUNT>';
- $expected .= '<CURRENCYCODE>' .
$options['currency_code'] . '</CURRENCYCODE>';
- $expected .= '<LANGUAGECODE>' .
$options['language'] . '</LANGUAGECODE>';
- $expected .= '<COUNTRYCODE>' .
$options['country'] . '</COUNTRYCODE>';
- $expected .=
'<HOSTEDINDICATOR>1</HOSTEDINDICATOR>';
- $expected .= '<RETURNURL>' .
$wgDonationInterfaceThankYouPage . '/' . $options['language'] . '</RETURNURL>';
- $expected .=
'<AUTHENTICATIONINDICATOR>0</AUTHENTICATIONINDICATOR>';
- $expected .= '<FIRSTNAME>' .
$options['fname'] . '</FIRSTNAME>';
- $expected .= '<SURNAME>' .
$options['lname'] . '</SURNAME>';
- $expected .= '<STREET>' .
$options['street'] . '</STREET>';
- $expected .= '<CITY>' .
$options['city'] . '</CITY>';
- $expected .= '<STATE>' .
$options['state'] . '</STATE>';
- $expected .= '<ZIP>' .
$options['zip'] . '</ZIP>';
- $expected .= '<EMAIL>' . TESTS_EMAIL . '</EMAIL>';
-
- // Set the issuer id if it is passed.
- if ( isset( $optionsForTestData['descriptor'] ) ) {
- $expected .= '<DESCRIPTOR>' .
$optionsForTestData['descriptor'] . '</DESCRIPTOR>';
- }
-
- // Set the issuer id if it is passed.
- if ( isset( $optionsForTestData['issuer_id'] ) ) {
- $expected .= '<ISSUERID>' .
$optionsForTestData['issuer_id'] . '</ISSUERID>';
- }
-
-
- // If we're doing Direct Debit...
- //@TODO: go ahead and split this out into a "Get the direct
debit I_OWP XML block function" the second this gets even slightly annoying.
- if ( $optionsForTestData['payment_method'] === 'dd' ) {
- $expected .= '<DATECOLLECT>' . gmdate( 'Ymd' ) .
'</DATECOLLECT>'; //is this cheating? Probably.
- $expected .= '<ACCOUNTNAME>' .
$optionsForTestData['account_name'] . '</ACCOUNTNAME>';
- $expected .= '<ACCOUNTNUMBER>' .
$optionsForTestData['account_number'] . '</ACCOUNTNUMBER>';
- $expected .= '<BANKCODE>' .
$optionsForTestData['bank_code'] . '</BANKCODE>';
- $expected .= '<BRANCHCODE>' .
$optionsForTestData['branch_code'] . '</BRANCHCODE>';
- $expected .= '<BANKCHECKDIGIT>' .
$optionsForTestData['bank_check_digit'] . '</BANKCHECKDIGIT>';
- $expected .= '<DIRECTDEBITTEXT>' .
$optionsForTestData['direct_debit_text'] . '</DIRECTDEBITTEXT>';
- }
-
- $expected .= '</PAYMENT>';
- $expected .= '</PARAMS>';
- $expected .= '</REQUEST>';
- $expected .= '</XML>';
-
- return $expected;
-
- }
-
- /**
- * Get a fresh gateway object of the type specified in the variable
- * $this->testAdapterClass.
- * @param array $external_data If you want to shoehorn in some external
- * data, do that here.
- * @param array $setup_hacks An array of things that override stuff in
- * the constructor of the gateway object that I can't get to without
- * refactoring the whole thing. @TODO: Refactor the gateway adapter
- * constructor.
- * @return \class The new relevant gateway adapter object.
- */
- function getFreshGatewayObject( $external_data = null, $setup_hacks =
array() ) {
- $p1 = null;
- if ( !is_null( $external_data ) ) {
- $p1 = array (
- 'external_data' => $external_data,
- );
- }
-
- if ( $setup_hacks ) {
- if ( !is_null( $p1 ) ) {
- $p1 = array_merge( $p1, $setup_hacks );
- } else {
- $p1 = $setup_hacks;
- }
- }
-
- $class = $this->testAdapterClass;
- $gateway = new $class( $p1 );
-
- // FIXME: Find a more elegant way to hackity hacken hack.
- // We want to override any define- functions with hacky values.
- foreach ( $setup_hacks as $field => $value ) {
- $gateway->$field = $value;
- }
-
- return $gateway;
- }
-
- function resetAllEnv() {
- $_SESSION = array ( );
- $_GET = array ( );
- $_POST = array ( );
-
- $_SERVER = array ( );
- $_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.1';
- $_SERVER['HTTP_HOST'] = TESTS_HOSTNAME;
- $_SERVER['SERVER_NAME'] = TESTS_HOSTNAME;
- $_SERVER['SCRIPT_NAME'] = __FILE__;
- }
-
- /**
- * Instantiates the $special_page_class with supplied $initial_vars,
- * yoinks the html output from the output buffer, loads that into a
- * DomDocument and performs asserts on the results per the checks
- * supplied in $perform_these_checks.
- * Optional: Asserts that the gateway has logged nothing at ERROR level.
- *
- * @param class $special_page_class A testing descendant of GatewayPage
- * @param array $initial_vars Array that will be loaded straight into a
- * test version of $wgRequest.
- * @param array $perform_these_checks Array of checks to perform in the
- * following format:
- *
$perform_these_checks[$element_id][$check_to_perform][$expected_result]
- * So far, $check_to_perform can be either 'nodename' or 'innerhtml'
- * @param boolean $fail_on_log_errors When true, this will fail the
- * current test if there are entries in the gateway's error log.
- */
- function verifyFormOutput( $special_page_class, $initial_vars,
$perform_these_checks, $fail_on_log_errors = false ) {
- // Nasty hack to clear output from any previous tests.
- $mainContext = RequestContext::getMain();
- $newOutput = new OutputPage( $mainContext );
- $newRequest = new TestingRequest( $initial_vars, false );
- $mainContext->setRequest( $newRequest );
- $mainContext->setOutput( $newOutput );
-
- $globals = array (
- 'wgRequest' => $newRequest,
- 'wgTitle' => Title::newFromText( 'nonsense is
apparently fine' ),
- 'wgOut' => $newOutput,
- );
-
- $this->setMwGlobals( $globals );
-
- $this->setLanguage( $initial_vars['language'] );
-
- ob_start();
- $formpage = new $special_page_class();
- $formpage->execute( NULL );
- $formpage->getOutput()->output();
- $form_html = ob_get_contents();
- ob_end_clean();
-
- // In the event that something goes crazy, uncomment the next
line for much easier local debugging
- // file_put_contents( '/tmp/xmlout.txt', $form_html );
-
- if ( $fail_on_log_errors ) {
- $this->verifyNoLogErrors( $formpage->adapter );
- }
-
- $dom_thingy = new DomDocument();
- //// DEBUGGING, foo
- // if (property_exists($this, 'FOO')) {
- //
error_log(var_export($formpage->getRequest()->response()->getheader('Location'),
true));
- // error_log(var_export($form_html, true));
- // }
-
- if ( $form_html ) {
- // p.s. i'm SERIOUS about the character encoding.
- $dom_thingy->loadHTML( '<?xml encoding="UTF-8">' .
$form_html );
- $dom_thingy->encoding = 'UTF-8';
- }
-
- foreach ( $perform_these_checks as $id => $checks ) {
- if ( $id == 'headers' ) {
- foreach ( $checks as $name => $expected ) {
- $actual =
$formpage->getRequest()->response()->getheader( $name );
- $this->performCheck( $actual,
$expected, "header '$name'");
- break;
- }
- continue;
- }
- unset( $perform_these_checks['headers'] );
-
- $input_node = $dom_thingy->getElementById( $id );
- $this->assertNotNull( $input_node, "Couldn't find the
'$id' element" );
- foreach ( $checks as $name => $expected ) {
- switch ( $name ) {
- case 'nodename':
- $this->performCheck(
$input_node->nodeName, $expected, "name of node with id '$id'");
- break;
- case 'innerhtml':
- $actual_html =
self::getInnerHTML( $input_node );
- // Strip comments
- $actual_html = preg_replace(
'/<!--[^>]*-->/', '', $actual_html );
- $this->performCheck(
$actual_html, $expected, "innerHTML of node '$id'");
- break;
- case 'innerhtmlmatches':
- $this->assertEquals( 1,
preg_match( $expected, self::getInnerHTML( $input_node ) ), "Value of the node
with id '$id' does not match pattern '$expected'. It has value " .
self::getInnerHTML( $input_node ) );
- break;
- case 'value':
- $this->performCheck(
$input_node->getAttribute('value'), $expected, "value of node with id '$id'");
- break;
- case 'selected':
- $selected = null;
- if ( $input_node->nodeName ===
'select' ) {
- $options =
$input_node->getElementsByTagName( 'option' );
- foreach ( $options as
$option ) {
- if (
$option->hasAttribute( 'selected' ) ) {
-
$selected = $option->getAttribute( 'value' );
- break;
- }
- }
- $this->performCheck(
$selected, $expected, "selected option value of node with id '$id'");
- } else {
- $this->fail( "Attempted
to test for selected value on non-select node, id '$id'" );
- }
- break;
- }
- }
- }
-
- // Are there untranslated boogers?
- if ( preg_match_all( '/<[^<]+(>|>)/', $form_html,
$matches ) ) {
- $this->fail( 'Untranslated messages present: ' .
implode( ', ', $matches[0] ) );
- }
-
- //because do_transaction is totally expected to leave session
artifacts...
-// $wgRequest = new FauxRequest();
- }
-
- /**
- * Performs some sort of assertion on a value.
- *
- * @param string $value the value to test
- * @param string|callable $check
- * if $check is callable, it is called with argument $value
- * otherwise, $value is asserted to be equal to $check
- * @param string $label identifies the value in assertion failures
- * @return void
- */
- function performCheck( $value, $check, $label = 'Tested value' ) {
- if ( is_callable( $check ) ) {
- $check( $value );
- return;
- }
- $this->assertEquals( $check, $value, "Expected $label to be
$check, found $value instead.");
- }
- /**
- * Asserts that $gateway has no log entries of LOG_ERR or worse.
- * @param object $gateway The gateway to check
- */
- function verifyNoLogErrors( $gateway ) {
- $log = $gateway->testlog;
-
- $this->assertTrue( is_array( $log ), "Missing the adapter
testlog" );
-
- //for our purposes, an "error" is LOG_ERR or less.
- $checklogs = array (
- LOG_ERR => "Oops: We've got LOG_ERRors.",
- LOG_CRIT => "Critical errors!",
- LOG_ALERT => "Log Alerts!",
- LOG_EMERG => "Logs says the servers are actually on
fire.",
- );
-
- $message = false;
- foreach ( $checklogs as $level => $levelmessage ) {
- if ( array_key_exists( $level, $log ) ) {
- $message = $levelmessage . ' ' . print_r(
$log[$level], true ) . "\n";
- }
- }
-
- $this->assertFalse( $message, $message ); //ha
- }
-
- /**
- * Finds a relevant line/lines in a gateway's log array
- * @param test adapter $gateway The gateway that should have the log
line you're looking for.
- * @param integer $log_level A standard level that the line should...
get logged at.
- * @param string $match A regex to match against the log lines.
- * @return mixed The full log line that matches the $match, an array if
there were multiples, or false if none were found.
- */
- public function getGatewayLogMatches( $gateway, $log_level, $match ) {
- $log = $gateway->testlog;
- if ( !array_key_exists( $log_level, $log ) ) {
- return false;
- }
-
- $return = array ( );
- foreach ( $log[$log_level] as $line ) {
- if ( preg_match( $match, $line ) ) {
- $return[] = $line;
- }
- }
-
- if ( empty( $return ) ) {
- return false;
- }
- if ( sizeof( $return ) === 1 ) {
- return $return[0];
- }
- return $return;
- }
-
- /**
- * Set global language for the duration of the test
- *
- * @param string $language language code to force
- */
- protected function setLanguage( $language ) {
- $newLang = new TestingLanguage();
- //this should be more robust, but... might have to work for now.
- $newLang->forceLang( $language );
-
- $this->setMwGlobals( array (
- 'wgLang' => $newLang,
- ) );
- }
-
- static function getInnerHTML( $node ) {
- $innerHTML = '';
- $children = $node->childNodes;
- foreach ( $children as $child ) {
- $innerHTML .= $child->ownerDocument->saveXML( $child );
- }
- return $innerHTML;
- }
-}
->>>>>>> BRANCH (fd2ed8 Merge "Fix form width for consistent cross-device
display")
diff --git a/tests/GatewayPageTest.php b/tests/GatewayPageTest.php
deleted file mode 100644
index 69e2ac3..0000000
--- a/tests/GatewayPageTest.php
+++ /dev/null
@@ -1,108 +0,0 @@
-<<<<<<< HEAD (aaa30f Annotation in generated forms links to source file)
-=======
-<?php
-/**
- * Wikimedia Foundation
- *
- * LICENSE
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
-
-/**
- * @group Fundraising
- * @group DonationInterface
- * @group GatewayPage
- */
-class GatewayPageTest extends DonationInterfaceTestCase {
-
- protected $page;
- protected $adapter;
-
- public function setUp() {
- $this->page = new TestingGatewayPage();
- $this->adapter = new TestingGenericAdapter();
- $this->adapter->addData( array(
- 'amount' => '120',
- 'currency_code' => 'SGD' ) );
- $this->adapter->errorsForRevalidate[0] = array( 'currency_code'
=> 'blah' );
- $this->adapter->errorsForRevalidate[1] = array();
- $this->page->adapter = $this->adapter;
- TestingGenericAdapter::$fakeGlobals = array (
'FallbackCurrency' => 'USD' );
- parent::setUp();
- }
-
- public function testFallbackWithNotification() {
- TestingGenericAdapter::$fakeGlobals['NotifyOnConvert'] = true;
-
- $this->page->validateForm();
-
- $this->assertTrue( $this->adapter->validatedOK() );
-
- $manualErrors = $this->adapter->getManualErrors();
- $msg = $this->page->msg(
'donate_interface-fallback-currency-notice', 'USD' )->text();
- $this->assertEquals( $msg, $manualErrors['general'] );
- $this->assertEquals( 100,
$this->adapter->getData_Unstaged_Escaped( 'amount' ) );
- $this->assertEquals( 'USD',
$this->adapter->getData_Unstaged_Escaped( 'currency_code' ) );
- }
-
- public function testFallbackIntermediateConversion() {
- TestingGenericAdapter::$fakeGlobals['FallbackCurrency'] = 'NZD';
- TestingGenericAdapter::$fakeGlobals['NotifyOnConvert'] = true;
-
- $this->page->validateForm();
-
- $manualErrors = $this->adapter->getManualErrors();
- $msg = $this->page->msg(
'donate_interface-fallback-currency-notice', 'NZD' )->text();
- $this->assertEquals( $msg, $manualErrors['general'] );
- $this->assertEquals( 110,
$this->adapter->getData_Unstaged_Escaped( 'amount' ) );
- $this->assertEquals( 'NZD',
$this->adapter->getData_Unstaged_Escaped( 'currency_code' ) );
- }
-
- public function testFallbackWithoutNotification() {
- TestingGenericAdapter::$fakeGlobals['NotifyOnConvert'] = false;
-
- $this->page->validateForm();
-
- $this->assertTrue( $this->adapter->validatedOK() );
-
- $manualErrors = $this->adapter->getManualErrors();
- $this->assertEquals( null, $manualErrors['general'] );
- $this->assertEquals( 100,
$this->adapter->getData_Unstaged_Escaped( 'amount' ) );
- $this->assertEquals( 'USD',
$this->adapter->getData_Unstaged_Escaped( 'currency_code' ) );
- }
-
- public function testFallbackAlwaysNotifiesIfOtherErrors() {
- TestingGenericAdapter::$fakeGlobals['NotifyOnConvert'] = false;
- $this->adapter->errorsForRevalidate[1] = array( 'amount' =>
'bad amount' );
-
- $this->page->validateForm();
-
- $manualErrors = $this->adapter->getManualErrors();
- $msg = $this->page->msg(
'donate_interface-fallback-currency-notice', 'USD' )->text();
- $this->assertEquals( $msg, $manualErrors['general'] );
- $this->assertEquals( 100,
$this->adapter->getData_Unstaged_Escaped( 'amount' ) );
- $this->assertEquals( 'USD',
$this->adapter->getData_Unstaged_Escaped( 'currency_code' ) );
- }
-
- public function testNoFallbackForSupportedCurrency() {
- $this->adapter->errorsForRevalidate[0] = array( 'address' =>
'blah' );
-
- $this->page->validateForm();
-
- $manualErrors = $this->adapter->getManualErrors();
- $this->assertEquals( null, $manualErrors['general'] );
- $this->assertEquals( 120,
$this->adapter->getData_Unstaged_Escaped( 'amount' ) );
- $this->assertEquals( 'SGD',
$this->adapter->getData_Unstaged_Escaped( 'currency_code' ) );
- }
-}
->>>>>>> BRANCH (fd2ed8 Merge "Fix form width for consistent cross-device
display")
diff --git a/tests/GatewayValidationTest.php b/tests/GatewayValidationTest.php
deleted file mode 100644
index 77315a4..0000000
--- a/tests/GatewayValidationTest.php
+++ /dev/null
@@ -1,167 +0,0 @@
-<?php
-/**
- * Wikimedia Foundation
- *
- * LICENSE
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
-
-/**
- * @group Fundraising
- * @group DonationInterface
- * @group GatewayPage
- */
-class GatewayValidationTest extends DonationInterfaceTestCase {
-
- protected $page;
- protected $adapter;
-
- public function setUp() {
- parent::setUp();
-
- $this->setMwGlobals( array(
- 'wgDonationInterfaceEnabledGateways' => array(
'donation' ), // base class. awkward.
- 'wgDonationInterfacePriceFloor' => 2.00,
- 'wgDonationInterfacePriceCeiling' => 100.00,
- ) );
-
- TestingGenericAdapter::$acceptedCurrencies[] = 'USD';
-
- $this->page = new TestingGatewayPage();
- $this->adapter = new TestingGenericAdapter();
- $this->page->adapter = $this->adapter;
- parent::setUp();
- }
-
- public function testPassesValidation() {
- $this->adapter->addData( array(
- 'amount' => '2.00',
- 'country' => 'US',
- 'currency' => 'USD',
- 'email' => '[email protected]',
- ) );
-
- $this->page->validateForm();
-
- $this->assertTrue( $this->adapter->validatedOK() );
- }
-
- public function testLowAmountError() {
- $this->adapter->addData( array(
- 'amount' => '1.99',
- 'country' => 'US',
- 'currency' => 'USD',
- ) );
-
- $this->page->validateForm();
-
- $this->assertFalse( $this->adapter->validatedOK() );
-
- $errors = $this->adapter->getValidationErrors();
- $this->assertArrayHasKey( 'amount', $errors );
- }
-
- public function testHighAmountError() {
- $this->adapter->addData( array(
- 'amount' => '100.99',
- 'country' => 'US',
- 'currency' => 'USD',
- ) );
-
- $this->page->validateForm();
-
- $this->assertFalse( $this->adapter->validatedOK() );
-
- $errors = $this->adapter->getValidationErrors();
- $this->assertArrayHasKey( 'amount', $errors );
- }
-
- public function testCurrencyCodeError() {
- $this->adapter->addData( array(
- 'amount' => '2.99',
- 'country' => 'US',
- 'currency' => 'ZZZ',
- ) );
-
- $this->page->validateForm();
-
- $this->assertFalse( $this->adapter->validatedOK() );
-
- $errors = $this->adapter->getValidationErrors();
- $this->assertArrayHasKey( 'currency_code', $errors );
- }
-
- public function testCountryError() {
- // TODO: also validate and test country=ZZ and XX
-
- $this->setMwGlobals( array(
- 'wgDonationInterfaceForbiddenCountries' => array( 'XX' )
- ) );
-
- $this->adapter->addData( array(
- 'amount' => '2.99',
- 'country' => 'XX',
- 'currency' => 'USD',
- ) );
-
- $this->page->validateForm();
-
- $this->assertFalse( $this->adapter->validatedOK() );
-
- $errors = $this->adapter->getValidationErrors();
- $this->assertArrayHasKey( 'country', $errors );
- }
-
- public function testEmailError() {
- $this->adapter->addData( array(
- 'amount' => '2.99',
- 'currency' => 'USD',
- 'email' => 'foo',
- ) );
-
- $this->page->validateForm();
-
- $this->assertFalse( $this->adapter->validatedOK() );
-
- $errors = $this->adapter->getValidationErrors();
- $this->assertArrayHasKey( 'emailAdd', $errors );
- }
-
- public function testSpuriousCcError() {
- $this->adapter->addData( array(
- 'amount' => '2.99',
- 'currency' => 'USD',
- 'fname' => '4111111111111111',
- ) );
-
- $this->page->validateForm();
-
- $this->assertFalse( $this->adapter->validatedOK() );
-
- $errors = $this->adapter->getValidationErrors();
- $this->assertArrayHasKey( 'fname', $errors );
- }
-
- public function testMissingFieldError() {
- $this->adapter->addData( array(
- 'amount' => '2.99',
- ) );
-
- $this->page->validateForm();
-
- $this->assertFalse( $this->adapter->validatedOK() );
-
- $errors = $this->adapter->getValidationErrors();
- $this->assertArrayHasKey( 'currency_code', $errors );
- }
-}
diff --git a/tests/TestConfiguration.php b/tests/TestConfiguration.php
deleted file mode 100644
index ffd2ebe..0000000
--- a/tests/TestConfiguration.php
+++ /dev/null
@@ -1,163 +0,0 @@
-<<<<<<< HEAD (aaa30f Annotation in generated forms links to source file)
-=======
-<?php
-/**
- * Wikimedia Foundation
- *
- * LICENSE
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * This file contains custom options and constants for test configuration.
- */
-
-/**
- * TESTS_MESSAGE_NOT_IMPLEMENTED
- *
- * Message for code that has not been implemented.
- */
-define( 'TESTS_MESSAGE_NOT_IMPLEMENTED', 'Not implemented yet!' );
-
-/**
- * TESTS_HOSTNAME
- *
- * The hostname for the system
- */
-define( 'TESTS_HOSTNAME', 'localhost' );
-
-/**
- * TESTS_EMAIL
- *
- * An email address to use in case test send mail
- */
-define( 'TESTS_EMAIL', '[email protected]' );
-
-/**
- * TESTS_GATEWAY_DEFAULT
- *
- * This is the default gateway that will be used to implement unit tests.
- */
-define( 'TESTS_GATEWAY_DEFAULT', 'GlobalCollectGateway' );
-
-/**
- * TESTS_ADAPTER_DEFAULT
- *
- * This is the default adapter that will be used to implement unit tests.
- */
-define( 'TESTS_ADAPTER_DEFAULT', 'TestingGlobalCollectAdapter' );
-
-global $wgDonationInterfaceTestMode,
- $wgDonationInterfaceMerchantID,
- $wgDonationInterfaceAllowedHtmlForms,
- $wgDonationInterfaceThankYouPage,
- $wgGlobalCollectGatewayAccountInfo,
- $wgPaypalGatewayAccountInfo,
- $wgPaypalGatewayReturnURL,
- $wgAmazonGatewayReturnURL,
- $wgAmazonGatewayAccountInfo,
- $wgAdyenGatewayBaseURL,
- $wgAdyenGatewayAccountInfo,
- $wgWorldPayGatewayAccountInfo,
- $wgWorldPayGatewayURL,
- $wgMinFraudLicenseKey,
- $wgMinFraudTimeout,
- $wgDonationInterfaceMinFraudServers,
- $wgDonationInterfaceEnableMinfraud,
- $wgDonationInterfaceEnableFunctionsFilter,
- $wgDonationInterfaceEnableReferrerFilter,
- $wgDonationInterfaceEnableSourceFilter;
-
-/**
- * Make sure the test setup is used, else we'll have the wrong classes.
- */
-/** DonationInterface General Settings **/
-$wgDonationInterfaceTestMode = true;
-$wgDonationInterfaceMerchantID = 'test';
-
-$wgDonationInterfaceAllowedHtmlForms = array(
- 'test' => array(
- ),
-);
-
-$wgDonationInterfaceThankYouPage =
'https://wikimediafoundation.org/wiki/Thank_You';
-
-
-/** GlobalCollect **/
-$wgGlobalCollectGatewayAccountInfo = array ( );
-$wgGlobalCollectGatewayAccountInfo['test'] = array (
- 'MerchantID' => 'test',
-);
-
-
-/** Paypal **/
-$wgPaypalGatewayAccountInfo = array ( );
-$wgPaypalGatewayAccountInfo['testing'] = array (
- 'AccountEmail' => '[email protected]',
-);
-$wgPaypalGatewayReturnURL = 'http://donate.wikimedia.org'; //whatever, doesn't
matter.
-
-
-/** Amazon **/
-$wgAmazonGatewayReturnURL =
'https://payments.wikimedia.org/index.php/Special:AmazonGateway';
-$wgAmazonGatewayAccountInfo['test'] = array (
- 'AccessKey' => 'testkey',
- 'SecretKey' => 'testsecret',
- 'PaymentsAccountID' => 'testaccountid',
- 'IpnOverride' => 'https://test.wikimedia.org/amazon',
-);
-
-/** Adyen **/
-$wgAdyenGatewayBaseURL = 'https://testorwhatever.adyen.com';
-$wgAdyenGatewayAccountInfo['test'] = array (
- 'AccountName' => 'wikitest',
- 'SharedSecret' => 'long-cat-is-long',
- 'SkinCode' => 'testskin',
-);
-
-/** WorldPay **/
-$wgWorldPayGatewayAccountInfo['test'] = array (
- 'Username' => 'testname',
- 'Password' => 'testpass',
- 'MerchantId' => '123456',
- 'Test' => true,
- 'TokenizingMerchantID' => '123456',
- 'StoreIDs' => array (
- '*/FJ/EUR' => array( 123456, 'fj_store_id' ),
- '*/*/EUR' => array( 123456, 'eur_store_id' ),
- '*/*/USD' => array( 123456, 'usd_store_id' ),
- ),
- 'MerchantIDs' => array(
- 123456 => array(
- 'Username' => 'testname2',
- 'Password' => 'testpass2',
- ),
- ),
- // Test special treatment - allow 'fail' CVV and missing AVS nodes
- 'SpecialSnowflakeStoreIDs' => array(
- 'fj_store_id',
- ),
-);
-$wgWorldPayGatewayURL = 'https://test.worldpay.com';
-
-$wgMinFraudLicenseKey = 'testkey';
-$wgMinFraudTimeout = 1;
-$wgDonationInterfaceMinFraudServers = array ( "minfraud.wikimedia.org" );
-
-//still can't quite handle mindfraud by itself yet, so default like this.
-//I will turn it on for individual tests in which I want to verify that it at
-//least fails closed when enabled.
-$wgDonationInterfaceEnableMinfraud = false;
-
-//...but we want these.
-$wgDonationInterfaceEnableFunctionsFilter = true;
-$wgDonationInterfaceEnableReferrerFilter = true;
-$wgDonationInterfaceEnableSourceFilter = true;
->>>>>>> BRANCH (fd2ed8 Merge "Fix form width for consistent cross-device
display")
diff --git a/tests/includes/TestingGatewayPage.php
b/tests/includes/TestingGatewayPage.php
deleted file mode 100644
index 79872d6..0000000
--- a/tests/includes/TestingGatewayPage.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-
-class TestingGatewayPage extends GatewayPage {
- public function __construct() {
- //nothing!
- }
- protected function handleRequest() {
- //also nothing!
- }
-}
diff --git a/tests/includes/test_gateway/TestingAdyenAdapter.php
b/tests/includes/test_gateway/TestingAdyenAdapter.php
deleted file mode 100644
index ac3f90a..0000000
--- a/tests/includes/test_gateway/TestingAdyenAdapter.php
+++ /dev/null
@@ -1,100 +0,0 @@
-<?php
-
-/**
- * TestingAdyenAdapter
- */
-class TestingAdyenAdapter extends AdyenAdapter {
-
- public $testlog = array ( );
-
- public function _buildRequestParams() {
- return $this->buildRequestParams();
- }
-
- //@TODO: That minfraud jerk needs its own isolated tests.
- function runAntifraudHooks() {
- //now screw around with the batch settings to trick the fraud
filters into triggering
- $is_batch = $this->isBatchProcessor();
- $this->batch = true;
-
- parent::runAntifraudHooks();
-
- $this->batch = $is_batch;
- }
-
- public function _getData_Staged() {
- return call_user_func_array( array ( $this, 'getData_Staged' ),
func_get_args() );
- }
-
- /**
- * So we can fake a risk score
- */
- public function setRiskScore( $score ) {
- $this->risk_score = $score;
- }
-
- /**
- * Trap the error log so we can use it in testing
- * @param type $msg
- * @param type $log_level
- * @param type $log_id_suffix
- */
- public function log( $msg, $log_level = LOG_INFO, $log_id_suffix = '' )
{
- //I don't care about the suffix right now, particularly.
- $this->testlog[$log_level][] = $msg;
- }
-
- /**
- * Set the error code you want the dummy response to return
- */
- public function setDummyGatewayResponseCode( $code ) {
- $this->dummyGatewayResponseCode = $code;
- }
-
- /**
- * Set the error code you want the dummy response to return
- */
- public function setDummyCurlResponseCode( $code ) {
- $this->dummyCurlResponseCode = $code;
- }
-
- /**
- * Load in some dummy response XML so we can test proper response
processing
- */
- protected function curl_exec( $ch ) {
- $code = '';
- if ( property_exists( $this, 'dummyGatewayResponseCode' ) ) {
- $code = '_' . $this->dummyGatewayResponseCode;
- }
-
- //could start stashing these in a further-down subdir if
payment type starts getting in the way,
- //but frankly I don't want to write tests that test our dummy
responses.
- $file_path = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . '..' .
DIRECTORY_SEPARATOR;
- $file_path .= 'Responses' . DIRECTORY_SEPARATOR .
self::getIdentifier() . DIRECTORY_SEPARATOR;
- $file_path .= $this->getCurrentTransaction() . $code .
'.testresponse';
-
- //these are all going to be short, so...
- if ( file_exists( $file_path ) ) {
- return file_get_contents( $file_path );
- } else {
- echo "File $file_path does not exist.\n"; //<-That will
deliberately break the test.
- return false;
- }
- }
-
- /**
- * Load in some dummy curl response info so we can test proper response
processing
- */
- protected function curl_getinfo( $ch, $opt = null ) {
- $code = 200; //response OK
- if ( property_exists( $this, 'dummyCurlResponseCode' ) ) {
- $code = ( int ) $this->dummyCurlResponseCode;
- }
-
- //put more here if it ever turns out that we care about it.
- return array (
- 'http_code' => $code,
- );
- }
-
-}
diff --git a/tests/includes/test_gateway/TestingAmazonAdapter.php
b/tests/includes/test_gateway/TestingAmazonAdapter.php
deleted file mode 100644
index 15cf618..0000000
--- a/tests/includes/test_gateway/TestingAmazonAdapter.php
+++ /dev/null
@@ -1,73 +0,0 @@
-<?php
-
-/**
- * TestingAmazonAdapter
- */
-class TestingAmazonAdapter extends AmazonAdapter {
-
- public static $fakeGlobals = array();
-
- public static function getGlobal( $name ) {
- if ( array_key_exists( $name,
TestingAmazonAdapter::$fakeGlobals ) ) {
- return TestingAmazonAdapter::$fakeGlobals[$name];
- }
- return parent::getGlobal( $name );
- }
-
- public function _buildRequestParams() {
- return $this->buildRequestParams();
- }
- /**
- * Set the error code you want the dummy response to return
- */
- public function setDummyGatewayResponseCode( $code ) {
- $this->dummyGatewayResponseCode = $code;
- }
-
- /**
- * Set the error code you want the dummy response to return
- */
- public function setDummyCurlResponseCode( $code ) {
- $this->dummyCurlResponseCode = $code;
- }
-
- /**
- * Load in some dummy response XML so we can test proper response
processing
- */
- protected function curl_exec( $ch ) {
- $code = '';
- if ( property_exists( $this, 'dummyGatewayResponseCode' ) ) {
- $code = '_' . $this->dummyGatewayResponseCode;
- }
-
- //could start stashing these in a further-down subdir if
payment type starts getting in the way,
- //but frankly I don't want to write tests that test our dummy
responses.
- $file_path = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . '..' .
DIRECTORY_SEPARATOR;
- $file_path .= 'Responses' . DIRECTORY_SEPARATOR .
self::getIdentifier() . DIRECTORY_SEPARATOR;
- $file_path .= $this->getCurrentTransaction() . $code .
'.testresponse';
-
- //these are all going to be short, so...
- if ( file_exists( $file_path ) ) {
- return file_get_contents( $file_path );
- } else {
- echo "File $file_path does not exist.\n"; //<-That will
deliberately break the test.
- return false;
- }
- }
-
- /**
- * Load in some dummy curl response info so we can test proper response
processing
- */
- protected function curl_getinfo( $ch, $opt = null ) {
- $code = 200; //response OK
- if ( property_exists( $this, 'dummyCurlResponseCode' ) ) {
- $code = ( int ) $this->dummyCurlResponseCode;
- }
-
- //put more here if it ever turns out that we care about it.
- return array (
- 'http_code' => $code,
- );
- }
-
-}
diff --git a/tests/includes/test_gateway/TestingGenericAdapter.php
b/tests/includes/test_gateway/TestingGenericAdapter.php
deleted file mode 100644
index a70a404..0000000
--- a/tests/includes/test_gateway/TestingGenericAdapter.php
+++ /dev/null
@@ -1,103 +0,0 @@
-<?php
-/**
- * Wikimedia Foundation
- *
- * LICENSE
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
-
-/**
- * A really dumb adapter.
- */
-class TestingGenericAdapter extends GatewayAdapter {
-
- /**
- * A list of fake errors that is returned each time revalidate() is
called.
- */
- public $errorsForRevalidate = array();
-
- public $revalidateCount = 0;
- public static $fakeGlobals = array();
-
- public static $acceptedCurrencies = array();
-
- public function revalidate($check_not_empty = array()) {
- if ( $this->errorsForRevalidate ) {
- $fakeErrors =
$this->errorsForRevalidate[$this->revalidateCount];
- if ( $fakeErrors !== null ) {
- $this->revalidateCount++;
- $this->setValidationErrors( $fakeErrors );
- return empty( $fakeErrors );
- }
- }
- return parent::revalidate($check_not_empty);
- }
-
- public function normalizeOrderID( $override = null, $dataObj = null ) {
- return '12345';
- }
-
- public static function getGlobal( $name ) {
- if ( array_key_exists( $name,
TestingGenericAdapter::$fakeGlobals ) ) {
- return TestingGenericAdapter::$fakeGlobals[$name];
- }
- return parent::getGlobal( $name );
- }
-
- public function defineAccountInfo() {
- }
-
- public function defineDataConstraints() {
- }
-
- public function defineErrorMap() {
- }
-
- public function defineOrderIDMeta() {
- }
-
- public function definePaymentMethods() {
- }
-
- public function defineReturnValueMap() {
- }
-
- public function defineStagedVars() {
- }
-
- public function defineTransactions() {
- }
-
- public function defineVarMap() {
- }
-
- public function getResponseData($response) {
- }
-
- public function getResponseErrors($response) {
- }
-
- public function getResponseStatus($response) {
- }
-
- public function processResponse($response, &$retryVars = null) {
- }
-
- public function setGatewayDefaults() {
- }
-
- public static function getCurrencies() {
- return TestingGenericAdapter::$acceptedCurrencies;
- }
-
-}
diff --git a/tests/includes/test_gateway/TestingGlobalCollectAdapter.php
b/tests/includes/test_gateway/TestingGlobalCollectAdapter.php
deleted file mode 100644
index 1bae8ee..0000000
--- a/tests/includes/test_gateway/TestingGlobalCollectAdapter.php
+++ /dev/null
@@ -1,181 +0,0 @@
-<?php
-
-/**
- * TestingGlobalCollectAdapter
- *
- * TODO: Add dependency injection to the base class so we don't have to repeat
code here.
- */
-class TestingGlobalCollectAdapter extends GlobalCollectAdapter {
- public $testlog = array ( );
-
- public $curled = array ( );
-
- public $limbo_stomps = array ( );
-
- /**
- * Also set a useful MerchantID.
- */
- public function __construct( $options = array ( ) ) {
- if ( is_null( $options ) ) {
- $options = array ( );
- }
-
- //I hate myself for this part, and so do you.
- //Deliberately not fixing the actual problem for this patchset.
- //@TODO: Change the way the constructor works in all adapter
- //objects, such that the mess I am about to make is no longer
- //necessary. A patchset may already be near-ready for this...
- if ( array_key_exists( 'order_id_meta', $options ) ) {
- $this->order_id_meta = $options['order_id_meta'];
- unset( $options['order_id_meta'] );
- }
-
- $this->options = $options;
-
- parent::__construct( $this->options );
- }
-
- /**
- * Clear the static globals cache.
- */
- public static function clearGlobalsCache() {
- self::$globalsCache = array ( );
- }
-
- /**
- * Returns the variable $this->dataObj which should be an instance of
- * DonationData.
- *
- * @return DonationData
- */
- public function getDonationData() {
- return $this->dataObj;
- }
-
- public function _addCodeRange() {
- return call_user_func_array(array($this, 'addCodeRange'),
func_get_args());
- }
-
- public function _findCodeAction() {
- return call_user_func_array(array($this, 'findCodeAction'),
func_get_args());
- }
-
- public function _buildRequestXML() {
- return call_user_func_array( array ( $this, 'buildRequestXML'
), func_get_args() );
- }
-
- public function _getData_Staged() {
- return call_user_func_array( array ( $this, 'getData_Staged' ),
func_get_args() );
- }
-
- public function _stageData() {
- $this->stageData();
- }
-
- /**
- * @TODO: Get rid of this and the override mechanism as soon as you
- * refactor the constructor into something reasonable.
- * @return type
- */
- public function defineOrderIDMeta() {
- if ( isset( $this->order_id_meta ) ) {
- return;
- }
- parent::defineOrderIDMeta();
- }
-
- /**
- * Stub out the limboStomp fn and record the calls
- * @param type $antiMessage
- */
- public function doLimboStompTransaction( $antiMessage = false ) {
- $this->limbo_stomps[] = $antiMessage;
- }
- /**
- * Trap the error log so we can use it in testing
- * @param type $msg
- * @param type $log_level
- * @param type $log_id_suffix
- */
- public function log( $msg, $log_level = LOG_INFO, $log_id_suffix = ''){
- //I don't care about the suffix right now, particularly.
- $this->testlog[$log_level][] = $msg;
- }
-
- //@TODO: That minfraud jerk needs its own isolated tests.
- function runAntifraudHooks() {
- //now screw around with the batch settings to trick the fraud
filters into triggering
- $is_batch = $this->isBatchProcessor();
- $this->batch = true;
-
- parent::runAntifraudHooks();
-
- $this->batch = $is_batch;
- }
-
- public function getRiskScore() {
- return $this->risk_score;
- }
-
- /**
- * Set the error code you want the dummy response to return
- */
- public function setDummyGatewayResponseCode( $code ) {
- $this->dummyGatewayResponseCode = $code;
- }
-
- /**
- * Set the error code you want the dummy response to return
- */
- public function setDummyCurlResponseCode( $code ) {
- $this->dummyCurlResponseCode = $code;
- }
-
- protected function curl_transaction( $data ) {
- $this->curled[] = $data;
- return parent::curl_transaction( $data );
- }
-
- /**
- * Load in some dummy response XML so we can test proper response
processing
- */
- protected function curl_exec( $ch ) {
- $code = '';
- if ( property_exists( $this, 'dummyGatewayResponseCode' ) ) {
- $code = '_' . $this->dummyGatewayResponseCode;
- if ( $this->dummyGatewayResponseCode == 'Exception' ) {
- throw new Exception('blah!');
- }
- }
-
- //could start stashing these in a further-down subdir if
payment type starts getting in the way,
- //but frankly I don't want to write tests that test our dummy
responses.
- $file_path = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . '..' .
DIRECTORY_SEPARATOR;
- $file_path .= 'Responses' . DIRECTORY_SEPARATOR .
self::getIdentifier() . DIRECTORY_SEPARATOR;
- $file_path .= $this->getCurrentTransaction() . $code .
'.testresponse';
-
- //these are all going to be short, so...
- if ( file_exists( $file_path ) ) {
- return file_get_contents( $file_path );
- } else {
- echo "File $file_path does not exist.\n"; //<-That will
deliberately break the test.
- return false;
- }
- }
-
- /**
- * Load in some dummy curl response info so we can test proper response
processing
- */
- protected function curl_getinfo( $ch, $opt = null ) {
- $code = 200; //response OK
- if ( property_exists( $this, 'dummyCurlResponseCode' ) ) {
- $code = ( int ) $this->dummyCurlResponseCode;
- }
-
- //put more here if it ever turns out that we care about it.
- return array (
- 'http_code' => $code,
- );
- }
-
-}
diff --git a/tests/includes/test_gateway/TestingGlobalCollectOrphanAdapter.php
b/tests/includes/test_gateway/TestingGlobalCollectOrphanAdapter.php
deleted file mode 100644
index cd088c3..0000000
--- a/tests/includes/test_gateway/TestingGlobalCollectOrphanAdapter.php
+++ /dev/null
@@ -1,166 +0,0 @@
-<?php
-
-/**
- * TestingGlobalCollectOrphanAdapter
- *
- * This is officially truly silly now.
- * TODO: Poke own eye out before you notice that multiple inheritance would, if
- * available, cause this file to deflate by 4/5ths.
- */
-
-class TestingGlobalCollectOrphanAdapter extends GlobalCollectOrphanAdapter {
-
- public $testlog = array ( );
-
- public $curled = array ( );
-
- /**
- * Also set a useful MerchantID.
- */
- public function __construct( $options = array ( ) ) {
- if ( is_null( $options ) ) {
- $options = array ( );
- }
-
- //I hate myself for this part, and so do you.
- //Deliberately not fixing the actual problem for this patchset.
- //@TODO: Change the way the constructor works in all adapter
- //objects, such that the mess I am about to make is no longer
- //necessary. A patchset may already be near-ready for this...
- if ( array_key_exists( 'order_id_meta', $options ) ) {
- $this->order_id_meta = $options['order_id_meta'];
- unset( $options['order_id_meta'] );
- }
-
- $this->options = $options;
-
- parent::__construct( $this->options );
- }
-
- /**
- * Returns the variable $this->dataObj which should be an instance of
- * DonationData.
- *
- * @return DonationData
- */
- public function getDonationData() {
- return $this->dataObj;
- }
-
- public function _addCodeRange() {
- return call_user_func_array( array ( $this, 'addCodeRange' ),
func_get_args() );
- }
-
- public function _findCodeAction() {
- return call_user_func_array( array ( $this, 'findCodeAction' ),
func_get_args() );
- }
-
- public function _buildRequestXML() {
- return call_user_func_array( array ( $this, 'buildRequestXML'
), func_get_args() );
- }
-
- public function _getData_Staged() {
- return call_user_func_array( array ( $this, 'getData_Staged' ),
func_get_args() );
- }
-
- public function _stageData() {
- $this->stageData();
- }
-
- /**
- * @TODO: Get rid of this and the override mechanism as soon as you
- * refactor the constructor into something reasonable.
- * @return type
- */
- public function defineOrderIDMeta() {
- if ( isset( $this->order_id_meta ) ) {
- return;
- }
- parent::defineOrderIDMeta();
- }
-
- /**
- * Trap the error log so we can use it in testing
- * @param type $msg
- * @param type $log_level
- * @param type $log_id_suffix
- */
- public function log( $msg, $log_level = LOG_INFO, $log_id_suffix = '' )
{
- //I don't care about the suffix right now, particularly.
- $this->testlog[$log_level][] = $msg;
- }
-
- //@TODO: That minfraud jerk needs its own isolated tests.
- function runAntifraudHooks() {
- //now screw around with the batch settings to trick the fraud
filters into triggering
- $is_batch = $this->isBatchProcessor();
- $this->batch = true;
-
- parent::runAntifraudHooks();
-
- $this->batch = $is_batch;
- }
-
- public function getRiskScore() {
- return $this->risk_score;
- }
-
- /**
- * Set the error code you want the dummy response to return
- */
- public function setDummyGatewayResponseCode( $code ) {
- $this->dummyGatewayResponseCode = $code;
- }
-
- /**
- * Set the error code you want the dummy response to return
- */
- public function setDummyCurlResponseCode( $code ) {
- $this->dummyCurlResponseCode = $code;
- }
-
- protected function curl_transaction( $data ) {
- $this->curled[] = $data;
- return parent::curl_transaction( $data );
- }
-
- /**
- * Load in some dummy response XML so we can test proper response
processing
- */
- protected function curl_exec( $ch ) {
- $code = '';
- if ( property_exists( $this, 'dummyGatewayResponseCode' ) ) {
- $code = '_' . $this->dummyGatewayResponseCode;
- }
-
- //could start stashing these in a further-down subdir if
payment type starts getting in the way,
- //but frankly I don't want to write tests that test our dummy
responses.
- $file_path = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . '..' .
DIRECTORY_SEPARATOR;
- $file_path .= 'Responses' . DIRECTORY_SEPARATOR .
self::getIdentifier() . DIRECTORY_SEPARATOR;
- $file_path .= $this->getCurrentTransaction() . $code .
'.testresponse';
-
- //these are all going to be short, so...
- if ( file_exists( $file_path ) ) {
- return file_get_contents( $file_path );
- } else {
- echo "File $file_path does not exist.\n"; //<-That will
deliberately break the test.
- return false;
- }
- }
-
- /**
- * Load in some dummy curl response info so we can test proper response
processing
- */
- protected function curl_getinfo( $ch, $opt = null ) {
- $code = 200; //response OK
- if ( property_exists( $this, 'dummyCurlResponseCode' ) ) {
- $code = ( int ) $this->dummyCurlResponseCode;
- }
-
- //put more here if it ever turns out that we care about it.
- return array (
- 'http_code' => $code,
- );
- }
-
-}
diff --git a/tests/includes/test_gateway/TestingPaypalAdapter.php
b/tests/includes/test_gateway/TestingPaypalAdapter.php
deleted file mode 100644
index b799500..0000000
--- a/tests/includes/test_gateway/TestingPaypalAdapter.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-
-/**
- * TestingPaypalAdapter
- * @TODO: Extend/damage things here. I'm sure we'll need it eventually...
- */
-class TestingPaypalAdapter extends PaypalAdapter {
- /**
- * Set the error code you want the dummy response to return
- */
- public function setDummyGatewayResponseCode( $code ) {
- $this->dummyGatewayResponseCode = $code;
- }
-
- /**
- * Set the error code you want the dummy response to return
- */
- public function setDummyCurlResponseCode( $code ) {
- $this->dummyCurlResponseCode = $code;
- }
-
- /**
- * Load in some dummy response XML so we can test proper response
processing
- */
- protected function curl_exec( $ch ) {
- $code = '';
- if ( property_exists( $this, 'dummyGatewayResponseCode' ) ) {
- $code = '_' . $this->dummyGatewayResponseCode;
- }
-
- //could start stashing these in a further-down subdir if
payment type starts getting in the way,
- //but frankly I don't want to write tests that test our dummy
responses.
- $file_path = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . '..' .
DIRECTORY_SEPARATOR;
- $file_path .= 'Responses' . DIRECTORY_SEPARATOR .
self::getIdentifier() . DIRECTORY_SEPARATOR;
- $file_path .= $this->getCurrentTransaction() . $code .
'.testresponse';
-
- //these are all going to be short, so...
- if ( file_exists( $file_path ) ) {
- return file_get_contents( $file_path );
- } else {
- echo "File $file_path does not exist.\n"; //<-That will
deliberately break the test.
- return false;
- }
- }
-
- /**
- * Load in some dummy curl response info so we can test proper response
processing
- */
- protected function curl_getinfo( $ch, $opt = null ) {
- $code = 200; //response OK
- if ( property_exists( $this, 'dummyCurlResponseCode' ) ) {
- $code = ( int ) $this->dummyCurlResponseCode;
- }
-
- //put more here if it ever turns out that we care about it.
- return array (
- 'http_code' => $code,
- );
- }
-
-}
diff --git a/tests/includes/test_gateway/TestingWorldPayAdapter.php
b/tests/includes/test_gateway/TestingWorldPayAdapter.php
deleted file mode 100644
index e571781..0000000
--- a/tests/includes/test_gateway/TestingWorldPayAdapter.php
+++ /dev/null
@@ -1,102 +0,0 @@
-<?php
-
-/**
- * TestingWorldPayAdapter
- */
-class TestingWorldPayAdapter extends WorldPayAdapter {
-
- public $testlog = array ( );
- public $curled = '';
-
- //@TODO: That minfraud jerk needs its own isolated tests.
- function runAntifraudHooks() {
- //now screw around with the batch settings to trick the fraud
filters into triggering
- $is_batch = $this->isBatchProcessor();
- $this->batch = true;
-
- parent::runAntifraudHooks();
-
- $this->batch = $is_batch;
- }
-
- /**
- * Trap the error log so we can use it in testing
- * @param type $msg
- * @param type $log_level
- * @param type $log_id_suffix
- */
- public function log( $msg, $log_level = LOG_INFO, $log_id_suffix = '' )
{
- //I don't care about the suffix right now, particularly.
- $this->testlog[$log_level][] = $msg;
- }
-
- public function getRiskScore() {
- return $this->risk_score;
- }
-
- /**
- * Set the error code you want the dummy response to return
- */
- public function setDummyGatewayResponseCode( $code ) {
- $this->dummyGatewayResponseCode = $code;
- }
-
- /**
- * Set the error code you want the dummy response to return
- */
- public function setDummyCurlResponseCode( $code ) {
- $this->dummyCurlResponseCode = $code;
- }
-
- protected function curl_transaction( $data ) {
- $this->curled = $data;
- return parent::curl_transaction( $data );
- }
-
- /**
- * Load in some dummy response XML so we can test proper response
processing
- */
- protected function curl_exec( $ch ) {
- $code = '';
- if ( property_exists( $this, 'dummyGatewayResponseCode' ) ) {
- $code = '_' . $this->dummyGatewayResponseCode;
- }
-
- //could start stashing these in a further-down subdir if
payment type starts getting in the way,
- //but frankly I don't want to write tests that test our dummy
responses.
- $file_path = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . '..' .
DIRECTORY_SEPARATOR;
- $file_path .= 'Responses' . DIRECTORY_SEPARATOR .
self::getIdentifier() . DIRECTORY_SEPARATOR;
- $file_path .= $this->getCurrentTransaction() . $code .
'.testresponse';
-
- //these are all going to be short, so...
- if ( file_exists( $file_path ) ) {
- return file_get_contents( $file_path );
- } else {
- echo "File $file_path does not exist.\n"; //<-That will
deliberately break the test.
- return false;
- }
- }
-
- /**
- * Load in some dummy curl response info so we can test proper response
processing
- */
- protected function curl_getinfo( $ch, $opt = null ) {
- $code = 200; //response OK
- if ( property_exists( $this, 'dummyCurlResponseCode' ) ) {
- $code = ( int ) $this->dummyCurlResponseCode;
- }
-
- //put more here if it ever turns out that we care about it.
- return array (
- 'http_code' => $code,
- );
- }
-
- public function _stageData() {
- $this->stageData();
- }
-
- public function _getData_Staged( $val = '' ) {
- return $this->getData_Staged( $val );
- }
-}
diff --git a/tests/includes/test_page/TestingAmazonGateway.php
b/tests/includes/test_page/TestingAmazonGateway.php
deleted file mode 100644
index 7799f6d..0000000
--- a/tests/includes/test_page/TestingAmazonGateway.php
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-
-class TestingAmazonGateway extends AmazonGateway {
- public function __construct() {
- $this->adapter = new TestingAmazonAdapter();
- GatewayPage::__construct();
- }
-}
diff --git a/tests/includes/test_page/TestingGlobalCollectGateway.php
b/tests/includes/test_page/TestingGlobalCollectGateway.php
deleted file mode 100644
index 84df6b0..0000000
--- a/tests/includes/test_page/TestingGlobalCollectGateway.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-/**
- * Wikimedia Foundation
- *
- * LICENSE
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
-
-/**
- * TestingGlobalCollectGateway
- * ...first off, I hate the name of the form classes.
- *
- * Second: DANGER! If we ever change the class that GlobalCollectGateway
extends
- * from, the tests will stop working correctly. But, the constructor is really
- * the only thing that we need to override.
- */
-class TestingGlobalCollectGateway extends GlobalCollectGateway {
-
- public function __construct() {
- $this->adapter = new TestingGlobalCollectAdapter();
- GatewayPage::__construct(); //DANGER: See main class comments.
- }
-
-}
diff --git a/tests/includes/test_page/TestingWorldPayGateway.php
b/tests/includes/test_page/TestingWorldPayGateway.php
deleted file mode 100644
index 2ee809b..0000000
--- a/tests/includes/test_page/TestingWorldPayGateway.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-
-class TestingWorldPayGateway extends WorldPayGateway {
-
- public function __construct() {
- $this->adapter = new TestingWorldPayAdapter();
- GatewayPage::__construct(); //DANGER: See main class comments.
- }
-
-}
diff --git a/tests/macros/suite-all-payment-gateways.htm
b/tests/macros/suite-all-payment-gateways.htm
deleted file mode 100644
index 234f206..0000000
--- a/tests/macros/suite-all-payment-gateways.htm
+++ /dev/null
@@ -1,32 +0,0 @@
-<<<<<<< HEAD (aaa30f Annotation in generated forms links to source file)
-=======
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
- <title>Test Suite</title>
-</head>
-<body>
-<table id="suiteTable" cellpadding="1" cellspacing="1" border="1"
class="selenium"><tbody>
-<tr><td><b>Test Suite</b></td></tr>
-<tr><td><a
href="form.globalcollect.default.us.htm">form.globalcollect.default.us</a></td></tr>
-<tr><td><a
href="form.globalcollect.webitects_2_3step.htm">form.globalcollect.webitects_2_3step</a></td></tr>
-<tr><td><a
href="form.twostepamount.banktransfer.netherlands.htm">form.twostepamount.banktransfer.netherlands</a></td></tr>
-<tr><td><a
href="form.twostepamount.banktransfer.netherlands.fail.not.a.valid.combination.htm">form.twostepamount.banktransfer.netherlands.fail.not.a.valid.combination</a></td></tr>
-<tr><td><a
href="form.twostepamount.banktransfer.spain.htm">form.twostepamount.banktransfer.spain</a></td></tr>
-<tr><td><a
href="form.twostepamount.creditcard.visa.us.htm">form.twostepamount.creditcard.visa.us</a></td></tr>
-<tr><td><a
href="form.twostepamount.directdebit.austria.htm">form.twostepamount.directdebit.austria</a></td></tr>
-<tr><td><a
href="form.twostepamount.directdebit.belgium.htm">form.twostepamount.directdebit.belgium</a></td></tr>
-<tr><td><a
href="form.twostepamount.directdebit.belgium.invalid.length.htm">form.twostepamount.directdebit.belgium.invalid.length</a></td></tr>
-<tr><td><a
href="form.twostepamount.directdebit.italy.htm">form.twostepamount.directdebit.italy</a></td></tr>
-<tr><td><a
href="form.twostepamount.directdebit.netherlands.htm">form.twostepamount.directdebit.netherlands</a></td></tr>
-<tr><td><a
href="form.twostepamount.directdebit.netherlands.fail.invalid.accountnumber.length.htm">form.twostepamount.directdebit.netherlands.fail.invalid.accountnumber.length</a></td></tr>
-<tr><td><a
href="form.twostepamount.realtimebanktransfer.enets.htm">form.twostepamount.realtimebanktransfer.enets</a></td></tr>
-<tr><td><a
href="form.twostepamount.realtimebanktransfer.eps.824.htm">form.twostepamount.realtimebanktransfer.eps.824</a></td></tr>
-<tr><td><a
href="form.twostepamount.realtimebanktransfer.ideal.771.htm">form.twostepamount.realtimebanktransfer.ideal.771</a></td></tr>
-<tr><td><a
href="form.twostepamount.realtimebanktransfer.nordea_sweden.htm">form.twostepamount.realtimebanktransfer.nordea_sweden</a></td></tr>
-</tbody></table>
-</body>
-</html>
->>>>>>> BRANCH (fd2ed8 Merge "Fix form width for consistent cross-device
display")
--
To view, visit https://gerrit.wikimedia.org/r/187590
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If735fa500c3cdd981a1e9510114ef0c040de183e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: deployment
Gerrit-Owner: Awight <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits