Ejegg has uploaded a new change for review.

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

Change subject: Merge branch 'master' into deployment
......................................................................

Merge branch 'master' into deployment

And delete tests

809bd7b Harmonize required field calculation
0a49093 Localisation updates from https://translatewiki.net.
77eb52c Rough PayPal Express Checkout integration
0e03254 Implement IsoDate
c371321 Use PROTO_CURRENT for paypal urls
7af9768 Localisation updates from https://translatewiki.net.
4285b3a Undo l10n adding blank values, breaking tests
013eb2d remove query string from referrer
bb4c140 Add GatewayInitialFilter hook
02dc490 Persist risk score array in session
7bc8bf2 Add order ID to pending queue messages
8ecdec7 Adyen: fill & hide cc name field for all but Hebrew
8c9e0c9 Localisation updates from https://translatewiki.net.
c7d83ff Fire IP velocity filter early
367cd39 Localisation updates from https://translatewiki.net.
a1fdd43 PayPal Express Checkout: support locale well enough to get ja_JP
aa943d1 Make locale staging generic

Change-Id: I8a40edb8524f96fc3ae5e8a84ea694abcbe84da7
---
D tests/Adapter/Adyen/AdyenTest.php
D tests/Adapter/AstroPay/AstroPayTest.php
D tests/Adapter/PayPal/PayPalExpressTest.php
D tests/Adapter/Worldpay/WorldpayTest.php
4 files changed, 0 insertions(+), 1,286 deletions(-)


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

diff --git a/tests/Adapter/Adyen/AdyenTest.php 
b/tests/Adapter/Adyen/AdyenTest.php
deleted file mode 100644
index f6073ec..0000000
--- a/tests/Adapter/Adyen/AdyenTest.php
+++ /dev/null
@@ -1,155 +0,0 @@
-<<<<<<< HEAD   (316176 Merge branch 'master' into deployment)
-=======
-<?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 Adyen
- */
-class DonationInterface_Adapter_Adyen_Test 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 = '' ) {
-               parent::__construct( $name, $data, $dataName );
-               $this->testAdapterClass = 'TestingAdyenAdapter';
-       }
-
-       public function setUp() {
-               parent::setUp();
-
-               $this->setMwGlobals( array(
-                       'wgAdyenGatewayEnabled' => true,
-               ) );
-       }
-
-       /**
-        * Integration test to verify that the donate transaction works as 
expected when all necessary data is present.
-        */
-       function testDoTransactionDonate() {
-               $init = $this->getDonorTestData();
-               $gateway = $this->getFreshGatewayObject( $init );
-
-               $gateway->do_transaction( 'donate' );
-               $exposed = TestingAccessWrapper::newFromObject( $gateway );
-               $ret = $exposed->buildRequestParams();
-
-               $expected = array (
-                       'allowedMethods' => 'card',
-                       'billingAddress.street' => $init['street'],
-                       'billingAddress.city' => $init['city'],
-                       'billingAddress.postalCode' => $init['zip'],
-                       'billingAddress.stateOrProvince' => $init['state'],
-                       'billingAddress.country' => $init['country'],
-                       'billingAddressType' => 2,
-                       'card.cardHolderName' => $init['fname'] . ' ' . 
$init['lname'],
-                       'currencyCode' => $init['currency_code'],
-                       'merchantAccount' => 'wikitest',
-                       'merchantReference' => $exposed->getData_Staged( 
'order_id' ),
-                       'merchantSig' => $exposed->getData_Staged( 
'hpp_signature' ),
-                       'paymentAmount' => ($init['amount']) * 100,
-//                     'sessionValidity' => '2014-03-09T19:41:50+00:00',       
//commenting out, because this is a problem.
-//                     'shipBeforeDate' => $exposed->getData_Staged( 
'expiration' ),   //this too.
-                       'skinCode' => 'testskin',
-                       'shopperLocale' => 'en_US',
-                       'shopperEmail' => 'nob...@wikimedia.org',
-                       'offset' => '52', //once we construct the 
FraudFiltersTestCase, it should land here.
-               );
-
-               //deal with problem keys.
-               //@TODO: Refactor gateway so these are more testable
-               $problems = array (
-                       'sessionValidity',
-                       'shipBeforeDate',
-               );
-
-               foreach ( $problems as $oneproblem ) {
-                       if ( isset( $ret[$oneproblem] ) ) {
-                               unset( $ret[$oneproblem] );
-                       }
-               }
-
-               $this->assertEquals( $expected, $ret, 'Adyen "donate" 
transaction not constructing the expected redirect URL' );
-               $this->assertNotNull( $gateway->getData_Unstaged_Escaped( 
'order_id' ), "Adyen order_id is null, and we need one for 'merchantReference'" 
);
-       }
-
-       function testRiskScoreAddedToQueueMessage() {
-               $init = $this->getDonorTestData();
-               $gateway = $this->getFreshGatewayObject( $init );
-
-               $exposed = TestingAccessWrapper::newFromObject( $gateway );
-               $exposed->risk_score = 57;
-               $message = $exposed->getStompTransaction();
-               $this->assertEquals( 57, $message['risk_score'], 'Risk score 
was not correctly added to queue message.' );
-       }
-
-       /**
-        * Make sure language is staged correctly when qs param is uppercase
-        */
-       function testLanguageCaseSensitivity() {
-               $init = $this->getDonorTestData();
-               $init['language'] = 'FR';
-               $gateway = $this->getFreshGatewayObject( $init );
-
-               $gateway->do_transaction( 'donate' );
-               $exposed = TestingAccessWrapper::newFromObject( $gateway );
-               $ret = $exposed->buildRequestParams();
-
-               $expected = array (
-                       'allowedMethods' => 'card',
-                       'billingAddress.street' => $init['street'],
-                       'billingAddress.city' => $init['city'],
-                       'billingAddress.postalCode' => $init['zip'],
-                       'billingAddress.stateOrProvince' => $init['state'],
-                       'billingAddress.country' => $init['country'],
-                       'billingAddressType' => 2,
-                       'card.cardHolderName' => $init['fname'] . ' ' . 
$init['lname'],
-                       'currencyCode' => $init['currency_code'],
-                       'merchantAccount' => 'wikitest',
-                       'merchantReference' => $exposed->getData_Staged( 
'order_id' ),
-                       'merchantSig' => $exposed->getData_Staged( 
'hpp_signature' ),
-                       'paymentAmount' => ($init['amount']) * 100,
-                       'skinCode' => 'testskin',
-                       'shopperLocale' => 'fr_US',
-                       'shopperEmail' => 'nob...@wikimedia.org',
-                       'offset' => '52',
-               );
-
-               //deal with problem keys.
-               //@TODO: Refactor gateway so these are more testable
-               $problems = array (
-                       'sessionValidity',
-                       'shipBeforeDate',
-               );
-
-               foreach ( $problems as $oneproblem ) {
-                       if ( isset( $ret[$oneproblem] ) ) {
-                               unset( $ret[$oneproblem] );
-                       }
-               }
-
-               $this->assertEquals( $expected, $ret, 'Adyen "donate" 
transaction not constructing the expected redirect URL' );
-               $this->assertNotNull( $gateway->getData_Unstaged_Escaped( 
'order_id' ), "Adyen order_id is null, and we need one for 'merchantReference'" 
);
-       }
-}
->>>>>>> BRANCH (aa943d Make locale staging generic)
diff --git a/tests/Adapter/AstroPay/AstroPayTest.php 
b/tests/Adapter/AstroPay/AstroPayTest.php
deleted file mode 100644
index ed5a79e..0000000
--- a/tests/Adapter/AstroPay/AstroPayTest.php
+++ /dev/null
@@ -1,599 +0,0 @@
-<<<<<<< HEAD   (316176 Merge branch 'master' into deployment)
-=======
-<?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.
- *
- */
-use \Psr\Log\LogLevel;
-
-/**
- *
- * @group Fundraising
- * @group DonationInterface
- * @group AstroPay
- */
-class DonationInterface_Adapter_AstroPay_AstroPayTest 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
-        */
-       function __construct( $name = null, array $data = array(), $dataName = 
'' ) {
-               parent::__construct( $name, $data, $dataName );
-               $this->testAdapterClass = 'TestingAstroPayAdapter';
-       }
-
-       function setUp() {
-               parent::setUp();
-               $this->setMwGlobals( array(
-                       'wgAstroPayGatewayEnabled' => true,
-               ) );
-       }
-
-       /**
-        * Ensure we're setting the right url for each transaction
-        * @covers AstroPayAdapter::getCurlBaseOpts
-        */
-       function testCurlUrl() {
-               $init = $this->getDonorTestData( 'BR' );
-               $gateway = $this->getFreshGatewayObject( $init );
-               $gateway->setCurrentTransaction( 'NewInvoice' );
-
-               $result = $gateway->getCurlBaseOpts();
-
-               $this->assertEquals(
-                       
'https://sandbox.astropay.example.com/api_curl/streamline/NewInvoice',
-                       $result[CURLOPT_URL],
-                       'Not setting URL to transaction-specific value.'
-               );
-       }
-
-       /**
-        * Test the NewInvoice transaction is making a sane request and signing
-        * it correctly
-        */
-       function testNewInvoiceRequest() {
-               $init = $this->getDonorTestData( 'BR' );
-               $session['Donor']['order_id'] = '123456789';
-               $this->setUpRequest( $init, $session );
-               $this->setLanguage( $init['language'] );
-               $gateway = new TestingAstroPayAdapter();
-
-               $gateway->do_transaction( 'NewInvoice' );
-               parse_str( $gateway->curled[0], $actual );
-
-               $expected = array(
-                       'x_login' => 'createlogin',
-                       'x_trans_key' => 'createpass',
-                       'x_invoice' => '123456789',
-                       'x_amount' => '100.00',
-                       'x_currency' => 'BRL',
-                       'x_bank' => 'TE',
-                       'x_country' => 'BR',
-                       'x_description' => wfMessage( 
'donate_interface-donation-description' )->inLanguage( $init['language'] 
)->text(),
-                       'x_iduser' => 'nob...@example.org',
-                       'x_cpf' => '00003456789',
-                       'x_name' => 'Nome Apelido',
-                       'x_email' => 'nob...@example.org',
-                       // 'x_address' => 'Rua Falso 123',
-                       // 'x_zip' => '01110-111',
-                       // 'x_city' => 'São Paulo',
-                       // 'x_state' => 'SP',
-                       'control' => 
'AC43664E0C4DF30607A26F271C8998BC4EE26511366E65AFB69B96E89BFD4359',
-                       'type' => 'json',
-               );
-               $this->assertEquals( $expected, $actual, 'NewInvoice is not 
including the right parameters' );
-       }
-
-       /**
-        * When AstroPay sends back valid JSON with status "0", we should set 
txn
-        * status to true and errors should be empty.
-        */
-       function testStatusNoErrors() {
-               $init = $this->getDonorTestData( 'BR' );
-               $gateway = $this->getFreshGatewayObject( $init );
-
-               $gateway->do_transaction( 'NewInvoice' );
-
-               $this->assertEquals( true, $gateway->getTransactionStatus(),
-                       'Transaction status should be true for code "0"' );
-
-               $this->assertEmpty( $gateway->getTransactionErrors(),
-                       'Transaction errors should be empty for code "0"' );
-       }
-
-       /**
-        * If astropay sends back non-JSON, communication status should be false
-        */
-       function testGibberishResponse() {
-               $init = $this->getDonorTestData( 'BR' );
-               $this->setLanguage( $init['language'] );
-               $gateway = $this->getFreshGatewayObject( $init );
-               $gateway->setDummyGatewayResponseCode( 'notJson' );
-
-               $gateway->do_transaction( 'NewInvoice' );
-
-               $this->assertEquals( false, $gateway->getTransactionStatus(),
-                       'Transaction status should be false for bad format' );
-       }
-
-       /**
-        * When AstroPay sends back valid JSON with status "1", we should set
-        * error array to generic error and log a warning.
-        */
-       function testStatusErrors() {
-               $init = $this->getDonorTestData( 'BR' );
-               $this->setLanguage( $init['language'] );
-               $gateway = $this->getFreshGatewayObject( $init );
-               $gateway->setDummyGatewayResponseCode( '1' );
-
-               $gateway->do_transaction( 'NewInvoice' );
-
-               $expected = array(
-                       'internal-0000' => wfMessage( 
'donate_interface-processing-error')->inLanguage( $init['language'] )->text()
-               );
-               $this->assertEquals( $expected, 
$gateway->getTransactionErrors(),
-                       'Wrong error for code "1"' );
-               $logged = $this->getLogMatches( LogLevel::WARNING, '/This error 
message should appear in the log./' );
-               $this->assertNotEmpty( $logged );
-       }
-
-       /**
-        * do_transaction should set redirect key when we get a valid response.
-        */
-       function testRedirectOnSuccess() {
-               $init = $this->getDonorTestData( 'BR' );
-               $gateway = $this->getFreshGatewayObject( $init );
-
-               $gateway->do_transaction( 'NewInvoice' );
-
-               // from the test response
-               $expected = 
'https://sandbox.astropaycard.com/go_to_bank?id=A5jvKfK1iHIRUTPXXt8lDFGaRRLzPgBg';
-               $response = $gateway->getTransactionResponse();
-               $this->assertEquals( $expected, $response->getRedirect(),
-                       'do_transaction is not setting the right redirect' );
-       }
-
-       /**
-        * do_transaction should set redirect key when we get a valid response.
-        */
-       function testDoPaymentSuccess() {
-               $init = $this->getDonorTestData( 'BR' );
-               $init['payment_method'] = 'cc';
-               $gateway = $this->getFreshGatewayObject( $init );
-
-               $result = $gateway->doPayment();
-
-               // from the test response
-               $expected = 
'https://sandbox.astropaycard.com/go_to_bank?id=A5jvKfK1iHIRUTPXXt8lDFGaRRLzPgBg';
-               $this->assertEquals( $expected, $result->getRedirect(),
-                       'doPayment is not setting the right redirect' );
-       }
-
-       /**
-        * When AstroPay sends back valid JSON with status "1", we should set
-        * error array to generic error and log a warning.
-        */
-       function testDoPaymentErrors() {
-               $init = $this->getDonorTestData( 'BR' );
-               $this->setLanguage( $init['language'] );
-               $gateway = $this->getFreshGatewayObject( $init );
-               $gateway->setDummyGatewayResponseCode( '1' );
-
-               $result = $gateway->doPayment();
-
-               $expectedMessage = wfMessage( 
'donate_interface-processing-error')->inLanguage( $init['language'] )->text();
-               $actual = $result->getErrors();
-               $this->assertEquals( $expectedMessage, 
$actual['internal-0000']['message'],
-                       'Wrong error array in PaymentResult' );
-
-               $logged = $this->getLogMatches( LogLevel::WARNING, '/This error 
message should appear in the log./' );
-               $this->assertNotEmpty( $logged );
-               // TODO: Should this really be a refresh, or should we finalize 
to failed here?
-               $this->assertTrue( $result->getRefresh(), 'PaymentResult should 
be a refresh' );
-       }
-
-       /**
-        * Should set a validation error on amount
-        */
-       function testDoPaymentLimitExceeded() {
-               $init = $this->getDonorTestData( 'BR' );
-               $this->setLanguage( $init['language'] );
-               $init['payment_method'] = 'cc';
-               $gateway = $this->getFreshGatewayObject( $init );
-               $gateway->setDummyGatewayResponseCode( 'limit_exceeded' );
-
-               $result = $gateway->doPayment();
-               $this->assertTrue( $result->getRefresh(), 'PaymentResult should 
be a refresh' );
-
-               $errors = $gateway->getTransactionResponse()->getErrors();
-               $expectedMessage = wfMessage( 
'donate_interface-error-msg-limit')->inLanguage( $init['language'] )->text();
-               $this->assertEquals( $expectedMessage, 
$errors['internal-0000']['message'] );
-               $this->assertEquals( 'amount', 
$errors['internal-0000']['context'] );
-       }
-
-       /**
-        * Should set a validation error on fiscal_number
-        */
-       function testDoPaymentBadFiscalNumber() {
-               $init = $this->getDonorTestData( 'BR' );
-               $this->setLanguage( $init['language'] );
-               $init['payment_method'] = 'cc';
-               $gateway = $this->getFreshGatewayObject( $init );
-               $gateway->setDummyGatewayResponseCode( 'fiscal_number' );
-
-               $result = $gateway->doPayment();
-               $this->assertTrue( $result->getRefresh(), 'PaymentResult should 
be a refresh' );
-
-               $errors = $gateway->getTransactionResponse()->getErrors();
-               $expectedMessage = DataValidator::getErrorMessage( 
'fiscal_number', 'calculated', $init['language'], $init['country'] );
-               $this->assertEquals( $expectedMessage, 
$errors['internal-0000']['message'] );
-               $this->assertEquals( 'fiscal_number', 
$errors['internal-0000']['context'] );
-       }
-
-       /**
-        * Should finalize to failed
-        */
-       function testDoPaymentUserUnauthorized() {
-               $init = $this->getDonorTestData( 'BR' );
-               $this->setLanguage( $init['language'] );
-               $init['payment_method'] = 'cc';
-               $gateway = $this->getFreshGatewayObject( $init );
-               $gateway->setDummyGatewayResponseCode( 'user_unauthorized' );
-
-               $result = $gateway->doPayment();
-               $this->assertTrue( $result->isFailed() );
-       }
-
-       /**
-        * Should tell the user to try again
-        */
-       function testDoPaymentCouldNotRegister() {
-               $init = $this->getDonorTestData( 'BR' );
-               $this->setLanguage( $init['language'] );
-               $init['payment_method'] = 'cc';
-               $gateway = $this->getFreshGatewayObject( $init );
-               $gateway->setDummyGatewayResponseCode( 'could_not_register' );
-
-               $result = $gateway->doPayment();
-               $this->assertTrue( $result->getRefresh(), 'PaymentResult should 
be a refresh' );
-
-               $errors = $gateway->getTransactionResponse()->getErrors();
-               $expectedMessage = wfMessage( 
'donate_interface-try-again')->inLanguage( $init['language'] )->text();
-               $this->assertEquals( $expectedMessage, 
$errors['internal-0000']['message'] );
-       }
-
-       /**
-        * Should tell the user to try again
-        */
-       function testDoPaymentCouldNotMakeDeposit() {
-               $init = $this->getDonorTestData( 'BR' );
-               $this->setLanguage( $init['language'] );
-               $init['payment_method'] = 'cc';
-               $gateway = $this->getFreshGatewayObject( $init );
-               $gateway->setDummyGatewayResponseCode( 'could_not_make_deposit' 
);
-
-               $result = $gateway->doPayment();
-               $this->assertTrue( $result->getRefresh(), 'PaymentResult should 
be a refresh' );
-
-               $errors = $gateway->getTransactionResponse()->getErrors();
-               $expectedMessage = wfMessage( 
'donate_interface-try-again')->inLanguage( $init['language'] )->text();
-               $this->assertEquals( $expectedMessage, 
$errors['internal-0000']['message'] );
-       }
-
-       /**
-        * PaymentStatus transaction should interpret the delimited response
-        */
-       function testPaymentStatus() {
-               $init = $this->getDonorTestData( 'BR' );
-               $session['Donor']['order_id'] = '123456789';
-               $this->setUpRequest( $init, $session );
-               $gateway = new TestingAstroPayAdapter();
-
-               $gateway->do_transaction( 'PaymentStatus' );
-
-               // from the test response
-               $expected = array(
-                       'result' => '9',
-                       'x_amount' => '100.00',
-                       'x_iduser' => '08feb2d12771bbcfeb86',
-                       'x_invoice' => '123456789',
-                       'PT' => '1',
-                       'x_control' => 
'0656B92DF44B814D48D84FED2F444CCA1E991A24A365FBEECCCA15B73CC08C2A',
-                       'x_document' => '987654321',
-                       'x_bank' => 'TE',
-                       'x_payment_type' => '03',
-                       'x_bank_name' => 'GNB',
-                       'x_currency' => 'BRL',
-               );
-               $results = $gateway->getTransactionData();
-               $this->assertEquals( $expected, $results,
-                       'PaymentStatus response not interpreted correctly' );
-               // Should not throw exception
-               $gateway->verifyStatusSignature( $results );
-       }
-
-       /**
-        * Invalid signature should be recognized as such.
-        */
-       function testInvalidSignature() {
-               $init = $this->getDonorTestData( 'BR' );
-               $session['Donor']['order_id'] = '123456789';
-               $this->setUpRequest( $init, $session );
-               $gateway = new TestingAstroPayAdapter();
-
-               $gateway->setDummyGatewayResponseCode( 'badsig' );
-               $gateway->do_transaction( 'PaymentStatus' );
-
-               $results = $gateway->getTransactionData();
-               $this->setExpectedException( 'ResponseProcessingException' );
-               $gateway->verifyStatusSignature( $results );
-       }
-
-       /**
-        * If status is paid and signature is correct, processResponse should 
not
-        * throw exception and final status should be 'completed'
-        */
-       function testSuccessfulReturn() {
-               $init = $this->getDonorTestData( 'BR' );
-               $session['Donor']['order_id'] = '123456789';
-               $this->setUpRequest( $init, $session );
-               $gateway = new TestingAstroPayAdapter();
-
-               // Next lines mimic AstroPay resultswitcher
-               $gateway->setCurrentTransaction( 'ProcessReturn' );
-               $response = array(
-                       'result' => '9',
-                       'x_amount' => '100.00',
-                       'x_amount_usd' => '42.05',
-                       'x_control' => 
'DDF89085AC70C0B0628150C51D64419D8592769F2439E3936570E26D24881730',
-                       'x_description' => 'Donation to the Wikimedia 
Foundation',
-                       'x_document' => '32869',
-                       'x_iduser' => '08feb2d12771bbcfeb86',
-                       'x_invoice' => '123456789',
-               );
-
-               $gateway->processResponse( $response );
-               $status = $gateway->getFinalStatus();
-               $this->assertEquals( FinalStatus::COMPLETE, $status );
-       }
-
-       /**
-        * Make sure we record the actual amount charged, even if the donor has
-        * opened a new window and screwed up their session data.
-        */
-       function testReturnUpdatesAmount() {
-               $init = $this->getDonorTestData( 'BR' );
-               $init['amount'] = '22.55'; // junk session data from another 
banner click
-               $session['Donor']['order_id'] = '123456789';
-               $this->setUpRequest( $init, $session );
-               $gateway = new TestingAstroPayAdapter();
-
-               $amount = $gateway->getData_Unstaged_Escaped( 'amount' );
-               $this->assertEquals( '22.55', $amount );
-
-               // Next lines mimic AstroPay resultswitcher
-               $gateway->setCurrentTransaction( 'ProcessReturn' );
-               $response = array(
-                       'result' => '9',
-                       'x_amount' => '100.00',
-                       'x_amount_usd' => '42.05',
-                       'x_control' => 
'DDF89085AC70C0B0628150C51D64419D8592769F2439E3936570E26D24881730',
-                       'x_description' => 'Donation to the Wikimedia 
Foundation',
-                       'x_document' => '32869',
-                       'x_iduser' => '08feb2d12771bbcfeb86',
-                       'x_invoice' => '123456789',
-               );
-
-               $gateway->processResponse( $response );
-               $amount = $gateway->getData_Unstaged_Escaped( 'amount' );
-               $this->assertEquals( '100.00', $amount, 'Not recording correct 
amount' );
-       }
-
-       /**
-        * If payment is rejected, final status should be 'failed'
-        */
-       function testRejectedReturn() {
-               $init = $this->getDonorTestData( 'BR' );
-               $session['Donor']['order_id'] = '123456789';
-               $this->setUpRequest( $init, $session );
-               $gateway = new TestingAstroPayAdapter();
-
-               $gateway->setCurrentTransaction( 'ProcessReturn' );
-               $response = array(
-                       'result' => '8', // rejected by bank
-                       'x_amount' => '100.00',
-                       'x_amount_usd' => '42.05',
-                       'x_control' => 
'706F57BC3E74906B14B1DEB946F027104513797CC62AC0F5107BC98F42D5DC95',
-                       'x_description' => 'Donation to the Wikimedia 
Foundation',
-                       'x_document' => '32869',
-                       'x_iduser' => '08feb2d12771bbcfeb86',
-                       'x_invoice' => '123456789',
-               );
-
-               $gateway->processResponse( $response );
-               $status = $gateway->getFinalStatus();
-               $this->assertEquals( FinalStatus::FAILED, $status );
-       }
-
-       function testStageBankCode() {
-               $init = $this->getDonorTestData( 'BR' );
-               $init['payment_method'] = 'cc';
-               $init['payment_submethod'] = 'elo';
-               $gateway = $this->getFreshGatewayObject( $init );
-
-               $gateway->doPayment();
-
-               $exposed = TestingAccessWrapper::newFromObject( $gateway );
-               $bank_code = $exposed->getData_Staged( 'bank_code' );
-               $this->assertEquals( 'EL', $bank_code, 'Not setting bank_code 
in doPayment' );
-       }
-
-       /**
-        * Test that we run the AntiFraud hooks before redirecting
-        */
-       function testAntiFraudHooks() {
-               DonationInterface_FraudFiltersTest::setupFraudMaps();
-               $init = $this->getDonorTestData( 'BR' );
-               $init['payment_method'] = 'cc';
-               $init['bank_code'] = 'VD';
-               // following data should trip fraud alarms
-               $init['utm_medium'] = 'somethingmedia';
-               $init['utm_source'] = 'somethingmedia';
-               $init['email'] = 'someb...@wikipedia.org';
-
-               $gateway = $this->getFreshGatewayObject( $init );
-
-               $result = $gateway->doPayment();
-
-               $this->assertTrue( $result->isFailed(), 'Result should be 
failure if fraud filters say challenge' );
-               $this->assertEquals( 'challenge', 
$gateway->getValidationAction(), 'Validation action is not as expected' );
-               $exposed = TestingAccessWrapper::newFromObject( $gateway );
-               $this->assertEquals( 60, $exposed->risk_score, 'RiskScore is 
not as expected' );
-       }
-
-       /**
-        * Before redirecting a user to the processor, we should log all of 
their
-        * details at info level
-        */
-       function testLogDetails() {
-               $init = $this->getDonorTestData( 'BR' );
-               $init['payment_method'] = 'cc';
-               $session['Donor']['order_id'] = '123456789';
-               $this->setUpRequest( $init, $session );
-               $gateway = new TestingAstroPayAdapter();
-
-               $gateway->doPayment();
-               $logged = $this->getLogMatches( LogLevel::INFO, '/^Redirecting 
for transaction: /' );
-               $this->assertEquals( 1, count( $logged ), 'Should have logged 
details once' );
-               preg_match( '/Redirecting for transaction: (.*)$/', $logged[0], 
$matches );
-               $detailString = $matches[1];
-               $expected = array(
-                       'referrer' => 'www.yourmom.com',
-                       'currency_code' => 'BRL',
-                       'payment_submethod' => 'test_bank',
-                       'fname' => 'Nome',
-                       'lname' => 'Apelido',
-                       'amount' => '100.00',
-                       'language' => 'pt',
-                       'email' => 'nob...@example.org',
-                       'country' => 'BR',
-                       'payment_method' => 'cc',
-                       'user_ip' => '127.0.0.1',
-                       'recurring' => '',
-                       'utm_source' => '..cc',
-                       'gateway' => 'astropay',
-                       'gateway_account' => 'test',
-                       'gateway_txn_id' => false,
-                       'response' => false,
-                       'correlation-id' => 'astropay-123456789',
-                       'order_id' => '123456789',
-                       'php-message-class' => 
'SmashPig\CrmLink\Messages\DonationInterfaceMessage',
-               );
-               $actual = json_decode( $detailString, true );
-               // TODO: when tests use PHPUnit 4.4
-               // $this->assertArraySubset( $expected, $actual, false, 'Logged 
the wrong stuff' );
-               unset( $actual['contribution_tracking_id'] );
-               unset( $actual['date'] );
-               $this->assertEquals( $expected, $actual, 'Logged the wrong 
stuff!' );
-       }
-
-       function testStageFiscalNumber() {
-               $init = $this->getDonorTestData( 'BR' );
-               $init['fiscal_number'] = '000.034.567-89';
-               $gateway = $this->getFreshGatewayObject( $init );
-
-               $gateway->doPayment();
-
-               $exposed = TestingAccessWrapper::newFromObject( $gateway );
-               $staged = $exposed->getData_Staged( 'fiscal_number' );
-               $this->assertEquals( '00003456789', $staged, 'Not stripping 
fiscal_number punctuation in doPayment' );
-       }
-
-       /**
-        * We should increment the order ID with each NewInvoice call
-        */
-       function testNewInvoiceOrderId() {
-               $init = $this->getDonorTestData( 'BR' );
-               $firstRequest = $this->setUpRequest( $init );
-               $firstAttempt = new TestingAstroPayAdapter();
-               $firstAttempt->setDummyGatewayResponseCode( '1' );
- 
-               $firstAttempt->doPayment();
-
-               $this->setUpRequest( $init, $firstRequest->getSessionArray() );
-               $secondAttempt = new TestingAstroPayAdapter();
-               $secondAttempt->doPayment();
-
-               parse_str( $firstAttempt->curled[0], $firstParams );
-               parse_str( $secondAttempt->curled[0], $secondParams );
-
-               $this->assertNotEquals( $firstParams['x_invoice'], 
$secondParams['x_invoice'],
-                       'Not generating new order id for NewInvoice call'
-               );
-       }
-
-       /**
-        * We should increment the order ID with each NewInvoice call, even when
-        * retrying inside a single doPayment call
-        */
-       function testNewInvoiceOrderIdRetry() {
-               $init = $this->getDonorTestData( 'BR' );
-               $gateway = $this->getFreshGatewayObject( $init );
-               $gateway->setDummyGatewayResponseCode( 'collision' );
- 
-               $gateway->doPayment();
-
-               parse_str( $gateway->curled[0], $firstParams );
-               parse_str( $gateway->curled[1], $secondParams );
-
-               $this->assertNotEquals( $firstParams['x_invoice'], 
$secondParams['x_invoice'],
-                       'Not generating new order id for retried NewInvoice 
call'
-               );
-       }
-
-       /**
-        * We should show an error for incompatible country / currency 
combinations
-        */
-       function testBadCurrencyForCountry() {
-               $init = $this->getDonorTestData( 'BR' );
-               $init['currency_code'] = 'CLP';
-               $gateway = $this->getFreshGatewayObject( $init );
-
-               $errors = $gateway->getValidationErrors();
-
-               $this->assertNotEmpty( $errors );
-               $this->assertTrue(
-                       isset( $errors['currency_code'] ),
-                       'Should show a currency code error for trying to use 
CLP in BR'
-               );
-       }
-
-       function testDummyFiscalNumber() {
-               $init = $this->getDonorTestData( 'MX' );
-               $gateway = $this->getFreshGatewayObject( $init );
-               $gateway->doPayment();
-
-               parse_str( $gateway->curled[0], $firstParams );
-               $fiscalNumber = $firstParams['x_cpf'];
-               $this->assertEquals(
-                       13, strlen( $fiscalNumber ),
-                       'Fake fiscal number should be 13 digits'
-               );
-       }
-}
->>>>>>> BRANCH (aa943d Make locale staging generic)
diff --git a/tests/Adapter/PayPal/PayPalExpressTest.php 
b/tests/Adapter/PayPal/PayPalExpressTest.php
deleted file mode 100644
index 161fb39..0000000
--- a/tests/Adapter/PayPal/PayPalExpressTest.php
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-/**
- * 
'TIMESTAMP=2016%2d05%2d02T19%3a58%3a19Z&CORRELATIONID=b33e6ff7eba&ACK=Failure&VERSION=0%2e000000&BUILD=21669447&L_ERRORCODE0=10002&L_SHORTMESSAGE0=Authentication%2fAuthorization%20Failed&L_LONGMESSAGE0=You%20do%20not%20have%20permissions%20to%20make%20this%20API%20call&L_SEVERITYCODE0=Error'
- *
- * 
TOKEN=EC%2d1YM52022PV490383V&PHONENUM=408%2d123%2d4567&BILLINGAGREEMENTACCEPTEDSTATUS=0&CHECKOUTSTATUS=PaymentActionNotInitiated&TIMESTAMP=2016%2d05%2d03T19%3a57%3a56Z&CORRELATIONID=c3811aeb1e7f5&ACK=Success&VERSION=124&BUILD=21669447&EMAIL=fr%2dtech%2bdonor%40wikimedia%2eorg&PAYERID=FLJLQ2GV38E4Y&PAYERSTATUS=verified&FIRSTNAME=f&LASTNAME=doner&COUNTRYCODE=US&ADDRESSSTATUS=Confirmed&CURRENCYCODE=JPY&AMT=500&ITEMAMT=500&SHIPPINGAMT=0&HANDLINGAMT=0&TAXAMT=0&CUSTOM=4116&DESC=Donation%20to%20the%20Wikimedia%20Foundation&INVNUM=4116&INSURANCEAMT=0&SHIPDISCAMT=0&INSURANCEOPTIONOFFERED=false&PAYMENTREQUEST_0_CURRENCYCODE=JPY&PAYMENTREQUEST_0_AMT=500&PAYMENTREQUEST_0_ITEMAMT=500&PAYMENTREQUEST_0_SHIPPINGAMT=0&PAYMENTREQUEST_0_HANDLINGAMT=0&PAYMENTREQUEST_0_TAXAMT=0&PAYMENTREQUEST_0_CUSTOM=4116&PAYMENTREQUEST_0_DESC=Donation%20to%20the%20Wikimedia%20Foundation&PAYMENTREQUEST_0_INVNUM=4116&PAYMENTREQUEST_0_INSURANCEAMT=0&PAYMENTREQUEST_0_SHIPDISCAMT=0&PAYMENTREQUEST_0_SELLERPAYPALACCOUNTID=fr%2dtech%2dfacilitator%40wikimedia%2eorg&PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED=false&PAYMENTREQUEST_0_ADDRESSSTATUS=Confirmed&PAYMENTREQUESTINFO_0_ERRORCODE=0
- *
- * 
TIMESTAMP=2016%2d05%2d03T21%3a43%3a20Z&CORRELATIONID=f624ed5aa5db0&ACK=Failure&VERSION=124&BUILD=21669447&L_ERRORCODE0=10412&L_SHORTMESSAGE0=Duplicate%20invoice&L_LONGMESSAGE0=Payment%20has%20already%20been%20made%20for%20this%20InvoiceID%2e&L_SEVERITYCODE0=Error
- */
diff --git a/tests/Adapter/Worldpay/WorldpayTest.php 
b/tests/Adapter/Worldpay/WorldpayTest.php
deleted file mode 100644
index b210ac6..0000000
--- a/tests/Adapter/Worldpay/WorldpayTest.php
+++ /dev/null
@@ -1,524 +0,0 @@
-<<<<<<< HEAD   (316176 Merge branch 'master' into deployment)
-=======
-<?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.
- *
- */
-use Psr\Log\LogLevel;
-
-/**
- *
- * @group Fundraising
- * @group DonationInterface
- * @group Worldpay
- */
-class DonationInterface_Adapter_Worldpay_WorldpayTest 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
-        */
-       function __construct( $name = null, array $data = array(), $dataName = 
'' ) {
-               parent::__construct( $name, $data, $dataName );
-               $this->testAdapterClass = 'TestingWorldpayAdapter';
-       }
-
-       public function setUp() {
-               global $wgWorldpayGatewayHtmlFormDir;
-               parent::setUp();
-
-               $this->setMwGlobals( array(
-                       'wgWorldpayGatewayEnabled' => true,
-                       'wgDonationInterfaceAllowedHtmlForms' => array(
-                               'testytest' => array(
-                                       'gateway' => 'worldpay',
-                               ),
-                               'worldpay' => array(
-                                       'file' => $wgWorldpayGatewayHtmlFormDir 
. '/worldpay.html',
-                                       'gateway' => 'worldpay',
-                                       'countries' => array( '+' => array( 
'AU', 'BE', 'CA', 'FR', 'GB', 'IL', 'NZ', 'US' ) ),
-                                       'currencies' => array( '+' => 'ALL' ),
-                                       'payment_methods' => array( 'cc' => 
'ALL' ),
-                                       'selection_weight' => 10
-                               ),
-                       ),
-               ) );
-       }
-
-       /**
-        * Just making sure we can instantiate the thing without blowing up 
completely
-        */
-       function testConstruct() {
-               $options = $this->getDonorTestData();
-               $class = $this->testAdapterClass;
-
-               $_SERVER['REQUEST_URI'] = 
GatewayFormChooser::buildPaymentsFormURL( 'testytest', array ( 'gateway' => 
$class::getIdentifier() ) );
-               $gateway = $this->getFreshGatewayObject( $options );
-
-               $this->assertInstanceOf( 'TestingWorldpayAdapter', $gateway );
-       }
-
-       /**
-        * Test the AntiFraud hooks
-        */
-       function testAntiFraudHooks() {
-               $options = $this->getDonorTestData( 'US' );
-               $options['utm_source'] = "somethingmedia";
-               $options['email'] = "someb...@wikipedia.org";
-
-               $gateway = $this->getFreshGatewayObject( $options );
-
-               $gateway->runAntifraudHooks();
-
-               $this->assertEquals( 'reject', $gateway->getValidationAction(), 
'Validation action is not as expected' );
-               $exposed = TestingAccessWrapper::newFromObject( $gateway );
-               $this->assertEquals( 113, $exposed->risk_score, 'RiskScore is 
not as expected' );
-       }
-
-       /**
-        * Just making sure we can instantiate the thing without blowing up 
completely
-        */
-       function testNeverLog() {
-               $options = $this->getDonorTestData();
-               $options['cvv'] = '123';
-               $class = $this->testAdapterClass;
-
-               $_SERVER['REQUEST_URI'] = 
GatewayFormChooser::buildPaymentsFormURL( 'testytest', array ( 'gateway' => 
$class::getIdentifier() ) );
-               $gateway = $this->getFreshGatewayObject( $options );
-
-               $this->assertInstanceOf( 'TestingWorldpayAdapter', $gateway );
-               $gateway->do_transaction( 'AuthorizePaymentForFraud' );
-
-               $loglines = $this->getLogMatches( LogLevel::INFO, '/Request 
XML/' );
-
-               $this->assertEquals( 1, count( $loglines ), "We did not receive 
exactly one logline back that contains request XML" );
-               $this->assertEquals( 1, preg_match( '/Cleaned/', $loglines[0] 
), 'The logline did not come back marked as "Cleaned".' );
-               $this->assertEquals( 0, preg_match( '/CNV/', $loglines[0] ), 
'The "Cleaned" logline contained CVN data!' );
-       }
-
-       function testWorldpayFormLoad() {
-               $init = $this->getDonorTestData();
-               unset( $init['order_id'] );
-               $init['payment_method'] = 'cc';
-               $init['email'] = 'someb...@wikipedia.org';
-               $init['payment_submethod'] = 'visa';
-               $init['ffname'] = 'worldpay';
-               $init['currency_code'] = 'EUR';
-
-               $assertNodes = array (
-                       'selected-amount' => array (
-                               'nodename' => 'span',
-                               'innerhtml' => '€1.55',
-                       ),
-                       'fname' => array(
-                               'nodename' => 'input',
-                               'value' => 'Firstname',
-                       ),
-                       'lname' => array(
-                               'nodename' => 'input',
-                               'value' => 'Surname',
-                       ),
-                       'street' => array(
-                               'nodename' => 'input',
-                               'value' => '123 Fake Street',
-                       ),
-                       'city' => array(
-                               'nodename' => 'input',
-                               'value' => 'San Francisco',
-                       ),
-                       'zip' => array(
-                               'nodename' => 'input',
-                               'value' => '94105',
-                       ),
-                       'country' => array(
-                               'nodename' => 'input',
-                               'value' => 'US',
-                       ),
-                       'email' => array(
-                               'nodename' => 'input',
-                               'value' => 'someb...@wikipedia.org',
-                       ),
-                       'language' => array(
-                               'nodename' => 'input',
-                               'value' => 'en',
-                       ),
-                       'state' => array(
-                               'nodename' => 'select',
-                               'selected' => 'CA',
-                       ),
-                       'informationsharing' => array (
-                               'nodename' => 'p',
-                               'innerhtml' => "By donating, you agree to share 
your personal information with the Wikimedia Foundation, the nonprofit 
organization that hosts Wikipedia and other Wikimedia projects, and its service 
providers pursuant to our <a 
href=\"//wikimediafoundation.org/wiki/Donor_policy\">donor policy</a>. 
Wikimedia Foundation and its service providers are located in the United States 
and in other countries whose privacy laws may not be equivalent to your own. We 
do not sell or trade your information to anyone. For more information please 
read our <a href=\"//wikimediafoundation.org/wiki/Donor_policy\">donor 
policy</a>."
-                       ),
-               );
-
-               $this->verifyFormOutput( 'TestingWorldpayGateway', $init, 
$assertNodes, true );
-       }
-
-       function testPaymentFormSubmit() {
-               $init = $this->getDonorTestData( 'FR' );
-               unset( $init['order_id'] );
-               $init['payment_method'] = 'cc';
-               $init['payment_submethod'] = 'visa';
-               $init['ffname'] = 'worldpay';
-               $init['currency_code'] = 'EUR';
-               $init['email'] = 'noemailfraudsc...@test.org';
-
-               $init['OTT'] = 'SALT123456789';
-
-               $assertNodes = array(
-                       'headers' => array(
-                               'Location' => 
'https://wikimediafoundation.org/wiki/Thank_You/fr?country=FR',
-                       ),
-               );
-
-               $this->verifyFormOutput( 'TestingWorldpayGateway', $init, 
$assertNodes, true );
-       }
-
-       function testWorldpayFormLoad_FR() {
-               $init = $this->getDonorTestData( 'FR' );
-               unset( $init['order_id'] );
-               $init['payment_method'] = 'cc';
-               $init['payment_submethod'] = 'visa';
-               $init['ffname'] = 'worldpay';
-
-               $assertNodes = array (
-                       'selected-amount' => array (
-                               'nodename' => 'span',
-                               'innerhtml' => '€1.55',
-                       ),
-                       'fname' => array (
-                               'nodename' => 'input',
-                               'value' => 'Prénom',
-                       ),
-                       'lname' => array (
-                               'nodename' => 'input',
-                               'value' => 'Nom',
-                       ),
-                       'country' => array (
-                               'nodename' => 'input',
-                               'value' => 'FR',
-                       ),
-               );
-
-               $this->verifyFormOutput( 'TestingWorldpayGateway', $init, 
$assertNodes, true );
-       }
-
-       /**
-        * Make sure Belgian form loads in all of that country's supported 
languages
-        * @dataProvider belgiumLanguageProvider
-        */
-       public function testWorldpayFormLoad_BE( $language ) {
-               $init = $this->getDonorTestData( 'BE' );
-               unset( $init['order_id'] );
-               $init['payment_method'] = 'cc';
-               $init['payment_submethod'] = 'visa';
-               $init['ffname'] = 'worldpay';
-               $init['language'] = $language;
-
-               $assertNodes = array (
-                       'selected-amount' => array (
-                               'nodename' => 'span',
-                               'innerhtml' => '€1.55',
-                       ),
-                       'fname-label' => array (
-                               'nodename' => 'label',
-                               'innerhtml' => wfMessage( 
'donate_interface-donor-fname' )->inLanguage( $language )->text(),
-                       ),
-                       'lname-label' => array (
-                               'nodename' => 'label',
-                               'innerhtml' => wfMessage( 
'donate_interface-donor-lname' )->inLanguage( $language )->text(),
-                       ),
-                       'email-label' => array (
-                               'nodename' => 'label',
-                               'innerhtml' => wfMessage( 
'donate_interface-donor-email' )->inLanguage( $language )->text(),
-                       ),
-                       'informationsharing' => array (
-                               'nodename' => 'p',
-                               'innerhtml' => wfMessage( 
'donate_interface-informationsharing', '.*' )->inLanguage( $language )->text(),
-                       ),
-               );
-
-               $this->verifyFormOutput( 'TestingWorldpayGateway', $init, 
$assertNodes, true );
-       }
-
-       /**
-        * Testing that we can retrieve the cvv_match value and run antifraud 
on it correctly
-        */
-       function testAntifraudCVVMatch() {
-               $options = $this->getDonorTestData(); //don't really care: 
We'll be using the dummy response directly.
-
-               $gateway = $this->getFreshGatewayObject( $options );
-               $gateway->do_transaction( 'AuthorizePaymentForFraud' );
-
-               $this->assertEquals( '1', $gateway->getData_Unstaged_Escaped( 
'cvv_result' ), 'cvv_result was not set after AuthorizePaymentForFraud' );
-               $this->assertTrue( $gateway->getCVVResult(), 'getCVVResult not 
passing somebody with a match.' );
-
-               //and now, for fun, test a wrong code.
-               $gateway->addResponseData( array ( 'cvv_result' => '2' ) );
-               $this->assertFalse( $gateway->getCVVResult(), 'getCVVResult not 
failing somebody with garbage.' );
-       }
-
-       /**
-        * Ensure we don't give too high a risk score when AVS address / zip 
match was not performed
-        */
-       function testAntifraudAllowsAvsNotPerformed() {
-               $options = $this->getDonorTestData('FR'); //don't really care: 
We'll be using the dummy response directly.
-
-               $gateway = $this->getFreshGatewayObject( $options );
-               $gateway->setDummyGatewayResponseCode( 9000 );
-               $gateway->do_transaction( 'AuthorizePaymentForFraud' );
-
-               $this->assertEquals( '9', $gateway->getData_Unstaged_Escaped( 
'avs_address' ), 'avs_address was not set after AuthorizePaymentForFraud' );
-               $this->assertEquals( '9', $gateway->getData_Unstaged_Escaped( 
'avs_zip' ), 'avs_zip was not set after AuthorizePaymentForFraud' );
-               $this->assertTrue( $gateway->getAVSResult() < 25, 'getAVSResult 
returning too high a score for AVS not performed.' );
-       }
-
-       /**
-        * Check to make sure we don't run antifraud filters (and burn a 
minfraud query) when we know the transaction has already failed
-        */
-       function testAntifraudNotPerformedOnGatewayError() {
-               global $wgHooks;
-               $hooksCopy = $wgHooks;
-               $hooksCopy['GatewayInitialFilter'] = array();
-               $this->setMwGlobals( array( 'wgHooks' => $hooksCopy ) );
-               $options = $this->getDonorTestData( 'FR' ); //don't really 
care: We'll be using the dummy response directly.
-
-               $gateway = $this->getFreshGatewayObject( $options );
-               $gateway->setDummyGatewayResponseCode( 2208 ); //account 
problems
-               $gateway->do_transaction( 'AuthorizePaymentForFraud' );
-
-               //assert that:
-               //#1 - the gateway object has an appropriate transaction error 
set
-               //#2 - antifraud checks were not performed.
-
-               //check for the error code that corresponds to the transaction 
coming back with a failure, rather than the one that we use for fraud fail.
-               $errors = $gateway->getTransactionErrors();
-               $this->assertTrue( !empty( $errors ), 'No errors in 
getTransactionErrors after a bad "AuthorizePaymentForFraud"' );
-               $this->assertTrue( array_key_exists( 'internal-0001', $errors 
), 'Unexpected error code' );
-
-               //check more things to make sure we didn't run any fraud filters
-               $loglines = $this->getLogMatches( LogLevel::INFO, '/Preparing 
to run custom filters/' );
-               $this->assertEmpty( $loglines, 'According to the logs, we ran 
antifraud filters and should not have' );
-               $this->assertEquals( 'process', 
$gateway->getValidationAction(), 'Validation action is not as expected' );
-               $exposed = TestingAccessWrapper::newFromObject( $gateway );
-               $this->assertEquals( 0, $exposed->risk_score, 'RiskScore is not 
as expected' );
-
-       }
-
-       /**
-        * Check to make sure we do run antifraud filters when we know the 
transaction is okay to go
-        */
-       function testAntifraudPerformedOnGatewayNoError() {
-               $options = $this->getDonorTestData( 'FR' ); //don't really 
care: We'll be using the dummy response directly.
-               $options['email'] = 't...@something.com';
-
-               $gateway = $this->getFreshGatewayObject( $options );
-//             $gateway->setDummyGatewayResponseCode( 2208 ); //account 
problems
-               $gateway->do_transaction( 'AuthorizePaymentForFraud' );
-
-               //assert that:
-               //#1 - the gateway object has no errors set
-               //#2 - antifraud checks were performed.
-               $errors = $gateway->getTransactionErrors();
-               $this->assertTrue( empty( $errors ), 'Errors assigned in 
getTransactionErrors after a good "AuthorizePaymentForFraud"' );
-               //check more things to make sure we did run the fraud filters
-               $loglines = $this->getLogMatches( LogLevel::INFO, 
'/CustomFiltersScores/' );
-               $this->assertNotEmpty( $loglines, 'No antifraud filters were 
run, according to the logs' );
-               $this->assertEquals( 'process', 
$gateway->getValidationAction(), 'Validation action is not as expected' );
-               $exposed = TestingAccessWrapper::newFromObject( $gateway );
-               $this->assertEquals( 0, $exposed->risk_score, 'RiskScore is not 
as expected' );
-       }
-
-       /**
-        * Ensure we're staging a punctuation-stripped version of the email 
address in merchant_reference_2
-        */
-       function testMerchantReference2() {
-               $options = $this->getDonorTestData();
-               $options['email'] = 'little+tea...@short.stout.com';
-               $gateway = $this->getFreshGatewayObject( $options );
-               $exposed = TestingAccessWrapper::newFromObject( $gateway );
-               $exposed->stageData();
-               $staged = $exposed->getData_Staged( 'merchant_reference_2' );
-               $this->assertEquals( 'little teapot short stout com', $staged );
-       }
-
-       function testTransliterateUtf8forEurocentricProcessor() {
-               $options = $this->getDonorTestData();
-               $options['fname'] = 'Barnabáš';
-               $options['lname'] = 'Voříšek';
-               $options['street'] = 'Truhlářská 320/62';
-               $options['city'] = 'České Budějovice';
-               $class = $this->testAdapterClass;
-
-               $_SERVER['REQUEST_URI'] = 
GatewayFormChooser::buildPaymentsFormURL( 'testytest', array ( 'gateway' => 
$class::getIdentifier() ) );
-               $gateway = $this->getFreshGatewayObject( $options );
-
-               $exposed = TestingAccessWrapper::newFromObject( $gateway );
-               $exposed->stageData();
-               $gateway->do_transaction( 'AuthorizeAndDepositPayment' );
-               $xml = new SimpleXMLElement( preg_replace( '/StringIn=/', '', 
$gateway->curled ) );
-               $this->assertEquals( 'Barnabás', $xml->FirstName );
-               $this->assertEquals( 'Vorísek', $xml->LastName );
-               $this->assertEquals( 'Truhlárská 320/62', $xml->Address1 );
-               $this->assertEquals( 'Ceské Budejovice', $xml->City );
-       }
-
-       /**
-        * Check that whacky #.# format orderid is unmolested by order_id_meta 
validation.
-        */
-       function testWackyOrderIdPassedValidation() {
-               $externalData = self::$initial_vars;
-               $externalData['order_id'] = '2143.0';
-               $options = array(
-                       'external_data' => $externalData,
-                       'batch_mode' => true,
-               );
-
-               $gateway = new TestingWorldpayAdapter( $options );
-               $this->assertEquals( $externalData['order_id'], 
$gateway->getData_Unstaged_Escaped( 'order_id' ),
-                       'Decimal Order ID should be allowed by orderIdMeta 
validation' );
-       }
-
-       /**
-        * Check that order_id is built from contribution_tracking id.
-        */
-       function testWackyOrderIdBasedOnContributionTracking() {
-               $externalData = self::$initial_vars;
-               $externalData['contribution_tracking_id'] = mt_rand();
-               $session = array( 'sequence' => 2 );
-
-               $this->setUpRequest( array(), $session );
-               $gateway = $this->getFreshGatewayObject( $externalData, array( 
'batch_mode' => TRUE, ) );
-               $expected_order_id = 
"{$externalData['contribution_tracking_id']}.{$session['sequence']}";
-               $this->assertEquals( $expected_order_id, 
$gateway->getData_Unstaged_Escaped( 'order_id' ),
-                       'Decimal Order ID is not correctly built from 
Contribution Tracking ID.' );
-       }
-
-       /**
-        * Ensure processResponse doesn't fail trxn for special accounts when 
AVS
-        * nodes are missing.
-        */
-       function testProcessResponseAllowsSnowflakeAVSMissing() {
-               $options = $this->getDonorTestData( 'FJ' ); // 'FJ' store ID is 
set up as a special exception
-
-               $gateway = $this->getFreshGatewayObject( $options );
-               $gateway->setDummyGatewayResponseCode( 'snowflake' );
-               $results = $gateway->do_transaction( 'AuthorizePaymentForFraud' 
);
-
-               // internal-0001 is the error code processRespose adds for 
missing nodes
-               $this->assertFalse( array_key_exists( 'internal-0001', 
$results->getErrors() ),
-                       'processResponse is failing a special snowflake account 
with a response missing AVS nodes' );
-       }
-
-       /**
-        * Ensure we don't give too high a risk score for special accounts when
-        * AVS address / zip match was not performed and CVV reports failure
-        */
-       function testAntifraudAllowsSnowflakeAVSMissingAndCVVMismatch() {
-               $options = $this->getDonorTestData( 'FJ' ); // 'FJ' store ID is 
set up as a special exception
-
-               $gateway = $this->getFreshGatewayObject( $options );
-               $gateway->setDummyGatewayResponseCode( 'snowflake' );
-               $gateway->do_transaction( 'AuthorizePaymentForFraud' );
-
-               $this->assertTrue( $gateway->getCVVResult(), 'getCVVResult 
failing snowflake account' );
-
-               $this->assertTrue( $gateway->getAVSResult() < 25, 'getAVSResult 
giving snowflake account too high a risk score' );
-       }
-
-       function testNarrativeStatement1() {
-               $class = $this->testAdapterClass;
-               $_SERVER['REQUEST_URI'] = 
GatewayFormChooser::buildPaymentsFormURL( 'testytest', array ( 'gateway' => 
$class::getIdentifier() ) );
-               $options = $this->getDonorTestData();
-               $options['contribution_tracking_id'] = mt_rand();
-               $gateway = $this->getFreshGatewayObject( $options );
-
-               $exposed = TestingAccessWrapper::newFromObject( $gateway );
-               $exposed->stageData();
-               $gateway->do_transaction( 'AuthorizeAndDepositPayment' );
-               $xml = new SimpleXMLElement( preg_replace( '/StringIn=/', '', 
$gateway->curled ) );
-               $this->assertEquals( "Wikimedia 
{$options['contribution_tracking_id']}", $xml->NarrativeStatement1 );
-       }
-
-       /**
-        * Check that we send different OrderNumbers for each transaction in a 
donation.
-        */
-       function testDistinctOrderNumberForEachTxn() {
-               $options = $this->getDonorTestData();
-               $gateway = $this->getFreshGatewayObject( $options );
-
-               $getOrderNumber = function() use ( $gateway ) {
-                       $xml = new SimpleXMLElement( preg_replace( 
'/StringIn=/', '', $gateway->curled ) );
-                       return $xml->OrderNumber;
-               };
-
-               $gateway->do_transaction( 'AuthorizePaymentForFraud' );
-               $fraudOrderNumber = $getOrderNumber();
-               $gateway->do_transaction( 'AuthorizeAndDepositPayment' );
-               $saleOrderNumber = $getOrderNumber();
-
-               $this->assertNotEquals( $fraudOrderNumber, $saleOrderNumber,
-                       'Sending same OrderNumber for both fraud auth and 
sale.' );
-       }
-
-       /**
-        * doPayment should return an empty result with normal data
-        */
-       function testDoPaymentSuccess() {
-               $init = $this->getDonorTestData();
-               $init['payment_method'] = 'cc';
-               $init['payment_submethod'] = 'visa';
-               $init['email'] = 'innoc...@clean.com';
-               $init['ffname'] = 'worldpay';
-               $init['currency_code'] = 'EUR';
-               $init['OTT'] = 'SALT123456789';
-               unset( $init['order_id'] );
-
-               $gateway = $this->getFreshGatewayObject( $init );
-               $result = $gateway->doPayment();
-               $this->assertEmpty( $result->isFailed(), 'PaymentResult should 
not be failed' );
-               $this->assertEmpty( $result->getErrors(), 'PaymentResult should 
have no errors' );
-       }
-
-       /**
-        * doPayment should return a failed result with data that triggers the 
fraud
-        * filter
-        */
-       function testDoPaymentFailed() {
-               $init = $this->getDonorTestData();
-               $init['payment_method'] = 'cc';
-               $init['payment_submethod'] = 'visa';
-               $init['email'] = 'nefari...@wikimedia.org'; //configured as 
fraudy
-               $init['ffname'] = 'worldpay';
-               $init['currency_code'] = 'EUR';
-               $init['OTT'] = 'SALT123456789';
-               unset( $init['order_id'] );
-
-               $gateway = $this->getFreshGatewayObject( $init );
-               $result = $gateway->doPayment();
-               $this->assertTrue( $result->isFailed(), 'PaymentResult should 
be failed' );
-               $errors = $result->getErrors();
-
-               $this->assertEquals(
-                       'Failed post-process checks for transaction type 
AuthorizePaymentForFraud.',
-                       $errors['internal-0000']['debugInfo'],
-                       'PaymentResult errors should include fraud check 
failure'
-               );
-       }
-}
->>>>>>> BRANCH (aa943d Make locale staging generic)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8a40edb8524f96fc3ae5e8a84ea694abcbe84da7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: deployment
Gerrit-Owner: Ejegg <eeggles...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to