jenkins-bot has submitted this change and it was merged. Change subject: Merge branch 'master' into deployment ......................................................................
Merge branch 'master' into deployment and delete tests and update vendor 8790155 Get rid of a js global fe5e19a Localisation updates from https://translatewiki.net. 9b34444 Add installer info to composer.json 8acadc3 Localisation updates from https://translatewiki.net. 1d9193f REALLY add order_id to queue messages 726e3e1 Localisation updates from https://translatewiki.net. 487e57a Write all limbo queues to new pending queue 087cc41 Localisation updates from https://translatewiki.net. d225f87 Depend on SmashPig; use looser caret versioning 0676476 Put LogPrefixProvider in its own file aac60ba Remove pre-1.27 compatibility shims cbc8a75 Configurable adapter classes 9385a8c Declare an autoloaded file in the top directory 25e0235 Catch up composer.lock with new libs 43fb0c2 Localisation updates from https://translatewiki.net. 9da296b Make RapidFail rapid, avoid redirect loop 4a92bfb Configurable queue mirroring Change-Id: I8ef0613456d9dfdb4b4b1ac28c4cc88f4c003859 --- D tests/Adapter/Amazon/AmazonTest.php D tests/Adapter/GatewayAdapterTest.php D tests/Adapter/GlobalCollect/GlobalCollectFormLoadTest.php D tests/Adapter/GlobalCollect/GlobalCollectOrphanAdapterTest.php D tests/Adapter/GlobalCollect/RealTimeBankTransferIdealTest.php D tests/DonationInterfaceTestCase.php D tests/DonationQueueTest.php D tests/GatewayValidationTest.php D tests/TestConfiguration.php D tests/includes/TestingGatewayPage.php M vendor 11 files changed, 1 insertion(+), 2,680 deletions(-) Approvals: Ejegg: Looks good to me, approved jenkins-bot: Verified diff --git a/tests/Adapter/Amazon/AmazonTest.php b/tests/Adapter/Amazon/AmazonTest.php deleted file mode 100644 index 771025b..0000000 --- a/tests/Adapter/Amazon/AmazonTest.php +++ /dev/null @@ -1,285 +0,0 @@ -<<<<<<< HEAD (226ee4 Make RapidFail rapid, avoid redirect loop) -======= -<?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 Amazon - */ -class DonationInterface_Adapter_Amazon_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 = 'TestingAmazonAdapter'; - } - - public function setUp() { - parent::setUp(); - - TestingAmazonAdapter::$mockClient = new MockAmazonClient(); - - $this->setMwGlobals( array( - 'wgAmazonGatewayEnabled' => true, - 'wgDonationInterfaceAllowedHtmlForms' => array( - 'amazon' => array( - 'gateway' => 'amazon', - 'payment_methods' => array('amazon' => 'ALL'), - 'redirect', - ), - 'amazon-recurring' => array( - 'gateway' => 'amazon', - 'payment_methods' => array('amazon' => 'ALL'), - 'redirect', - 'recurring', - ), - ), - ) ); - } - - public function tearDown() { - TestingAmazonAdapter::$fakeGlobals = array(); - parent::tearDown(); - } - - /** - * Integration test to verify that the Amazon gateway converts Canadian - * dollars before redirecting - * - * @dataProvider canadaLanguageProvider - */ - function testCanadianDollarConversion( $language ) { - $init = $this->getDonorTestData( 'CA' ); - unset( $init['order_id'] ); - $init['payment_method'] = 'amazon'; - $init['ffname'] = 'amazon'; - $init['language'] = $language; - $rates = CurrencyRates::getCurrencyRates(); - $cadRate = $rates['CAD']; - - $expectedAmount = floor( $init['amount'] / $cadRate ); - - TestingAmazonAdapter::$fakeGlobals = array( - 'FallbackCurrency' => 'USD', - 'NotifyOnConvert' => true, - ); - - $expectedNotification = wfMessage( - 'donate_interface-fallback-currency-notice', - 'USD' - )->inLanguage( $language )->text(); - - $locale = $init['language'] . '_' . $init['country']; - $expectedDisplayAmount = Amount::format( $expectedAmount, 'USD', $locale ); - - $that = $this; //needed for PHP pre-5.4 - $convertTest = function( $amountString ) use ( $expectedDisplayAmount, $that ) { - $that->assertEquals( $expectedDisplayAmount, trim( $amountString ), 'Displaying wrong amount' ); - }; - - $assertNodes = array( - 'selected-amount' => array( 'innerhtml' => $convertTest ), - 'mw-content-text' => array( - 'innerhtmlmatches' => "/.*$expectedNotification.*/" - ) - ); - $this->verifyFormOutput( 'AmazonGateway', $init, $assertNodes, false ); - } - - /** - * Integration test to verify that the Amazon gateway shows an error message when validation fails. - */ - function testShowFormOnError() { - $init = $this->getDonorTestData(); - $init['OTT'] = 'SALT123456789'; - $init['amount'] = '-100.00'; - $init['ffname'] = 'amazon'; - $session = array( 'Donor' => $init ); - $errorMessage = wfMessage( 'donate_interface-error-msg-invalid-amount' )->text(); - $assertNodes = array( - 'mw-content-text' => array( - 'innerhtmlmatches' => "/.*$errorMessage.*/" - ) - ); - - $this->verifyFormOutput( 'AmazonGateway', $init, $assertNodes, false, $session ); - } - - /** - * Check that the adapter makes the correct calls for successful donations - */ - function testDoPaymentSuccess() { - $init = $this->getDonorTestData( 'US' ); - $init['amount'] = '10.00'; - $init['order_reference_id'] = mt_rand( 0, 10000000 ); // provided by client-side widget IRL - // We don't get any profile data up front - unset( $init['email'] ); - unset( $init['fname'] ); - unset( $init['lname'] ); - - $gateway = $this->getFreshGatewayObject( $init ); - $result = $gateway->doPayment(); - // FIXME: PaymentResult->isFailed returns null for false - $this->assertTrue( !( $result->isFailed() ), 'Result should not be failed when responses are good' ); - $this->assertEquals( 'Testy', $gateway->getData_Unstaged_Escaped( 'fname' ), 'Did not populate first name from Amazon data' ); - $this->assertEquals( 'Test', $gateway->getData_Unstaged_Escaped( 'lname' ), 'Did not populate last name from Amazon data' ); - $this->assertEquals( 'nob...@wikimedia.org', $gateway->getData_Unstaged_Escaped( 'email' ), 'Did not populate email from Amazon data' ); - $mockClient = TestingAmazonAdapter::$mockClient; - $setOrderReferenceDetailsArgs = $mockClient->calls['setOrderReferenceDetails'][0]; - $oid = $gateway->getData_Unstaged_Escaped( 'order_id' ); - $this->assertEquals( $oid, $setOrderReferenceDetailsArgs['seller_order_reference_id'], 'Did not set order id on order reference' ); - $this->assertEquals( $init['amount'], $setOrderReferenceDetailsArgs['amount'], 'Did not set amount on order reference' ); - $this->assertEquals( $init['currency_code'], $setOrderReferenceDetailsArgs['currency_code'], 'Did not set currency code on order reference' ); - $queued = $gateway->queue_messages; - $this->assertNotEmpty( $queued['complete'], 'Not sending a message to the complete queue' ); - $message = $queued['complete'][0]; - $this->assertEquals( 'S01-0391295-0674065-C095112', $message['gateway_txn_id'], 'Queue message has wrong txn ID' ); - } - - /** - * Check that declined authorization is reflected in the result's errors - */ - function testDoPaymentDeclined() { - $init = $this->getDonorTestData( 'US' ); - $init['amount'] = '10.00'; - $init['order_reference_id'] = mt_rand( 0, 10000000 ); // provided by client-side widget IRL - // We don't get any profile data up front - unset( $init['email'] ); - unset( $init['fname'] ); - unset( $init['lname'] ); - - $mockClient = TestingAmazonAdapter::$mockClient; - $mockClient->returns['authorize'][] = 'InvalidPaymentMethod'; - - $gateway = $this->getFreshGatewayObject( $init ); - $result = $gateway->doPayment(); - - $this->assertTrue( $result->getRefresh(), 'Result should be a refresh on error' ); - $errors = $result->getErrors(); - $this->assertTrue( isset( $errors['InvalidPaymentMethod'] ), 'InvalidPaymentMethod error should be set' ); - } - - /** - * This apparently indicates a shady enough txn that we should turn them away - */ - function testFailOnAmazonRejected() { - $init = $this->getDonorTestData( 'US' ); - $init['amount'] = '10.00'; - $init['order_reference_id'] = mt_rand( 0, 10000000 ); // provided by client-side widget IRL - // We don't get any profile data up front - unset( $init['email'] ); - unset( $init['fname'] ); - unset( $init['lname'] ); - - $mockClient = TestingAmazonAdapter::$mockClient; - $mockClient->returns['authorize'][] = 'AmazonRejected'; - - $gateway = $this->getFreshGatewayObject( $init ); - $result = $gateway->doPayment(); - - $this->assertTrue( $result->isFailed(), 'Result should be failed' ); - // Could assert something about errors after rebasing onto master - // $errors = $result->getErrors(); - // $this->assertTrue( isset( $errors['AmazonRejected'] ), 'AmazonRejected error should be set' ); - } - - /** - * When the transaction times out, just gotta fail it till we work out an - * asynchronous authorization flow - */ - function testTransactionTimedOut() { - $init = $this->getDonorTestData( 'US' ); - $init['amount'] = '10.00'; - $init['order_reference_id'] = mt_rand( 0, 10000000 ); // provided by client-side widget IRL - // We don't get any profile data up front - unset( $init['email'] ); - unset( $init['fname'] ); - unset( $init['lname'] ); - - $mockClient = TestingAmazonAdapter::$mockClient; - $mockClient->returns['authorize'][] = 'TransactionTimedOut'; - - $gateway = $this->getFreshGatewayObject( $init ); - $result = $gateway->doPayment(); - - $this->assertTrue( $result->isFailed(), 'Result should be failed' ); - } - - /** - * When the SDK throws an exceptions, we should handle it. - */ - function testClientException() { - $init = $this->getDonorTestData( 'US' ); - $init['amount'] = '10.00'; - $init['order_reference_id'] = mt_rand( 0, 10000000 ); // provided by client-side widget IRL - // We don't get any profile data up front - unset( $init['email'] ); - unset( $init['fname'] ); - unset( $init['lname'] ); - - $mockClient = TestingAmazonAdapter::$mockClient; - $mockClient->exceptions['authorize'][] = new Exception( 'Test' ); - - $gateway = $this->getFreshGatewayObject( $init ); - $result = $gateway->doPayment(); - - $errors = $result->getErrors(); - $this->assertTrue( isset( $errors[ResponseCodes::NO_RESPONSE] ), 'NO_RESPONSE error should be set' ); - } - - /** - * Check the adapter makes the correct calls for successful monthly donations - */ - function testDoRecurringPaymentSuccess() { - $init = $this->getDonorTestData( 'US' ); - $init['amount'] = '10.00'; - $init['recurring'] = '1'; - $init['subscr_id'] = 'C01-9650293-7351908'; - // We don't get any profile data up front - unset( $init['email'] ); - unset( $init['fname'] ); - unset( $init['lname'] ); - - $gateway = $this->getFreshGatewayObject( $init ); - $result = $gateway->doPayment(); - // FIXME: PaymentResult->isFailed returns null for false - $this->assertTrue( !( $result->isFailed() ), 'Result should not be failed when responses are good' ); - $this->assertEquals( 'Testy', $gateway->getData_Unstaged_Escaped( 'fname' ), 'Did not populate first name from Amazon data' ); - $this->assertEquals( 'Test', $gateway->getData_Unstaged_Escaped( 'lname' ), 'Did not populate last name from Amazon data' ); - $this->assertEquals( 'nob...@wikimedia.org', $gateway->getData_Unstaged_Escaped( 'email' ), 'Did not populate email from Amazon data' ); - $mockClient = TestingAmazonAdapter::$mockClient; - $setBillingAgreementDetailsArgs = $mockClient->calls['setBillingAgreementDetails'][0]; - $oid = $gateway->getData_Unstaged_Escaped( 'order_id' ); - $this->assertEquals( $oid, $setBillingAgreementDetailsArgs['seller_billing_agreement_id'], 'Did not set order id on billing agreement' ); - $authorizeOnBillingAgreementDetailsArgs = $mockClient->calls['authorizeOnBillingAgreement'][0]; - $this->assertEquals( $init['amount'], $authorizeOnBillingAgreementDetailsArgs['authorization_amount'], 'Did not authorize correct amount' ); - $this->assertEquals( $init['currency_code'], $authorizeOnBillingAgreementDetailsArgs['currency_code'], 'Did not authorize correct currency code' ); - $queued = $gateway->queue_messages; - $this->assertNotEmpty( $queued['complete'], 'Not sending a message to the complete queue' ); - $message = $queued['complete'][0]; - $this->assertEquals( 'S01-5318994-6362993-C004044', $message['gateway_txn_id'], 'Queue message has wrong txn ID' ); - $this->assertEquals( $init['subscr_id'], $message['subscr_id'], 'Queue message has wrong subscription ID' ); - } -} ->>>>>>> BRANCH (4a92bf Configurable queue mirroring) diff --git a/tests/Adapter/GatewayAdapterTest.php b/tests/Adapter/GatewayAdapterTest.php deleted file mode 100644 index 52bf644..0000000 --- a/tests/Adapter/GatewayAdapterTest.php +++ /dev/null @@ -1,338 +0,0 @@ -<<<<<<< HEAD (226ee4 Make RapidFail rapid, avoid redirect loop) -======= -<?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. - * - */ - -/** - * TODO: Test everything. - * Make sure all the basic functions in the gateway_adapter are tested here. - * Also, the extras and their hooks firing properly and... that the fail score - * they give back is acted upon in the way we think it does. - * Hint: For that mess, use GatewayAdapter's $debugarray - * - * Also, note that it barely makes sense to test the functions that need to be - * defined in each gateway as per the abstract class. If we did that here, we'd - * basically be just testing the test code. So, don't do it. - * Those should definitely be tested in the various gateway-specific test - * classes. - * - * @group Fundraising - * @group DonationInterface - * @group Splunge - */ -class DonationInterface_Adapter_GatewayAdapterTest 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 $wgDonationInterfaceAllowedHtmlForms; - global $wgDonationInterfaceTest; - $wgDonationInterfaceTest = true; - parent::__construct( $name, $data, $dataName ); - } - - public function setUp() { - parent::setUp(); - - $this->setMwGlobals( array( - 'wgDonationInterfaceAllowedHtmlForms' => array( - 'testytest' => array( - 'gateway' => 'globalcollect', // RAR. - ), - 'rapidFailError' => array( - 'file' => 'error-cc.html', - 'gateway' => array( 'globalcollect', 'adyen', 'amazon', 'astropay', 'paypal' ), - 'special_type' => 'error', - ) - ), - ) ); - } - - /** - * - * @covers GatewayAdapter::__construct - * @covers GatewayAdapter::defineVarMap - * @covers GatewayAdapter::defineReturnValueMap - * @covers GatewayAdapter::defineTransactions - */ - public function testConstructor() { - - $options = $this->getDonorTestData(); - $class = $this->testAdapterClass; - - $_SERVER['REQUEST_URI'] = GatewayFormChooser::buildPaymentsFormURL( - 'testytest', array( 'gateway' => $class::getIdentifier() ) - ); - $gateway = $this->getFreshGatewayObject( $options ); - - $this->assertInstanceOf( TESTS_ADAPTER_DEFAULT, $gateway ); - - $this->resetAllEnv(); - $gateway = $this->getFreshGatewayObject( $options = array() ); - $this->assertInstanceOf( TESTS_ADAPTER_DEFAULT, $gateway, "Having trouble constructing a blank adapter." ); - } - - /** - * - * @covers GatewayAdapter::__construct - * @covers DonationData::__construct - */ - public function testConstructorHasDonationData() { - - $_SERVER['REQUEST_URI'] = '/index.php/Special:GlobalCollectGateway?form_name=TwoStepAmount'; - - $options = $this->getDonorTestData(); - $gateway = $this->getFreshGatewayObject( $options ); - - $this->assertInstanceOf( 'TestingGlobalCollectAdapter', $gateway ); - - // please define this function only inside the TESTS_ADAPTER_DEFAULT, - // which should be a test adapter object that descende from one of the - // production adapters. - $exposed = TestingAccessWrapper::newFromObject( $gateway ); - $this->assertInstanceOf( 'DonationData', $exposed->dataObj ); - } - - public function testLanguageChange() { - $options = $this->getDonorTestData( 'US' ); - $options['payment_method'] = 'cc'; - $options['payment_submethod'] = 'visa'; - $gateway = $this->getFreshGatewayObject( $options ); - - $exposed = TestingAccessWrapper::newFromObject( $gateway ); - $this->assertEquals( $exposed->getData_Staged( 'language' ), 'en', "'US' donor's language was inproperly set. Should be 'en'" ); - $gateway->do_transaction( 'INSERT_ORDERWITHPAYMENT' ); - // so we know it tried to screw with the session and such. - - $options = $this->getDonorTestData( 'NO' ); - $gateway = $this->getFreshGatewayObject( $options ); - $exposed = TestingAccessWrapper::newFromObject( $gateway ); - $this->assertEquals( $exposed->getData_Staged( 'language' ), 'no', "'NO' donor's language was inproperly set. Should be 'no'" ); - } - - /** - * Make sure data is cleared out when changing gateways. - * In particular, ensure order IDs aren't leaking. - */ - public function testResetOnGatewaySwitch() { - // Fill the session with some GlobalCollect stuff - $init = $this->getDonorTestData( 'FR' ); - $firstRequest = $this->setUpRequest( $init ); - $globalcollect_gateway = new TestingGlobalCollectAdapter(); - $globalcollect_gateway->do_transaction( 'Donate' ); - - $session = $firstRequest->getSessionArray(); - $this->assertEquals( 'globalcollect', $session['Donor']['gateway'], 'Test setup failed.' ); - - //Then simulate switching to Adyen - $session['sequence'] = 2; - unset( $init['order_id'] ); - - $secondRequest = $this->setUpRequest( $init, $session ); - $adyen_gateway = new TestingAdyenAdapter(); - $adyen_gateway->batch_mode = true; - - $session = $secondRequest->getSessionArray(); - $ctId = $adyen_gateway->getData_Unstaged_Escaped( 'contribution_tracking_id' ); - $expected_order_id = "$ctId.{$session['sequence']}"; - $this->assertEquals( $expected_order_id, $adyen_gateway->getData_Unstaged_Escaped( 'order_id' ), - 'Order ID was not regenerated on gateway switch!' ); - } - - public function testResetOnRecurringSwitch() { - // Donor initiates a non-recurring donation - $init = $this->getDonorTestData(); - $init['payment_method'] = 'cc'; - - $firstRequest = $this->setUpRequest( $init ); - - $gateway = new TestingGlobalCollectAdapter(); - $gateway->do_transaction( 'Donate' ); - - $donorData = $firstRequest->getSessionData( 'Donor' ); - $this->assertEquals( '', $donorData['recurring'], 'Test setup failed.' ); - $oneTimeOrderId = $gateway->getData_Unstaged_Escaped( 'order_id' ); - - // Then they go back and decide they want to make a recurring donation - - $init['recurring'] = '1'; - $secondRequest = $this->setUpRequest( $init, $firstRequest->getSessionArray() ); - - $gateway = new TestingGlobalCollectAdapter(); - $gateway->do_transaction( 'Donate' ); - $donorData = $secondRequest->getSessionData( 'Donor' ); - $this->assertEquals( '1', $donorData['recurring'], 'Test setup failed.' ); - - $recurOrderId = $gateway->getData_Unstaged_Escaped( 'order_id' ); - - $this->assertNotEquals( $oneTimeOrderId, $recurOrderId, - 'Order ID was not regenerated on recurring switch!' ); - } - - public function testResetSubmethodOnMethodSwitch() { - // Donor thinks they want to make a bank transfer, submits form - $init = $this->getDonorTestData( 'BR' ); - $init['payment_method'] = 'bt'; - $init['payment_submethod'] = 'itau'; - - $firstRequest = $this->setUpRequest( $init ); - - $gateway = new TestingAstroPayAdapter(); - $gateway->do_transaction( 'Donate' ); - - $donorData = $firstRequest->getSessionData( 'Donor' ); - $this->assertEquals( 'itau', $donorData['payment_submethod'], 'Test setup failed.' ); - - // Then they go back and decide they want to donate via credit card - $init['payment_method'] = 'cc'; - unset( $init['payment_submethod'] ); - - $secondRequest = $this->setUpRequest( $init, $firstRequest->getSessionArray() ); - - $gateway = new TestingAstroPayAdapter(); - $newMethod = $gateway->getData_Unstaged_Escaped( 'payment_method' ); - $newSubmethod = $gateway->getData_Unstaged_Escaped( 'payment_submethod' ); - - $this->assertEquals( 'cc', $newMethod, 'Test setup failed' ); - $this->assertEquals( '', $newSubmethod, 'Submethod was not blanked on method switch' ); - } - - public function testStreetStaging() { - $options = $this->getDonorTestData( 'BR' ); - unset( $options['street'] ); - $options['payment_method'] = 'cc'; - $options['payment_submethod'] = 'visa'; - $this->setUpRequest( $options ); - $gateway = new TestingGlobalCollectAdapter(); - - $exposed = TestingAccessWrapper::newFromObject( $gateway ); - $exposed->stageData(); - - $this->assertEquals( 'N0NE PROVIDED', $exposed->getData_Staged( 'street' ), - 'Street must be stuffed with fake data to prevent AVS scam.' ); - } - - public function testZipStaging() { - $options = $this->getDonorTestData( 'BR' ); - unset( $options['zip'] ); - $options['payment_method'] = 'cc'; - $options['payment_submethod'] = 'visa'; - $this->setUpRequest( $options ); - $gateway = new TestingGlobalCollectAdapter(); - - $exposed = TestingAccessWrapper::newFromObject( $gateway ); - $exposed->stageData(); - - $this->assertEquals( '0', $exposed->getData_Staged( 'zip' ), - 'Postal code must be stuffed with fake data to prevent AVS scam.' ); - } - - public function testGetRapidFailPage() { - $this->setMwGlobals( array( - 'wgDonationInterfaceRapidFail' => true, - ) ); - $options = $this->getDonorTestData( 'US' ); - $options['payment_method'] = 'cc'; - $gateway = $this->getFreshGatewayObject( $options ); - $this->assertEquals( 'rapidFailError', ResultPages::getFailPage( $gateway ) ); - } - - public function testGetFallbackFailPage() { - $this->setMwGlobals( array( - 'wgDonationInterfaceRapidFail' => false, - 'wgDonationInterfaceFailPage' => 'Main_Page', //coz we know it exists - ) ); - $options = $this->getDonorTestData( 'US' ); - $gateway = $this->getFreshGatewayObject( $options ); - $page = ResultPages::getFailPage( $gateway ); - $expectedTitle = Title::newFromText( 'Main_Page' ); - $expectedURL = wfAppendQuery( $expectedTitle->getFullURL(), 'uselang=en' ); - $this->assertEquals( $expectedURL, $page ); - } - - // TODO: Move to ResultsPagesTest.php - public function testGetFailPageForType() { - $url = ResultPages::getFailPageForType( 'GlobalCollectAdapter' ); - $expectedTitle = Title::newFromText( 'Donate-error' ); - $expectedURL = wfAppendQuery( $expectedTitle->getFullURL(), 'uselang=en' ); - $this->assertEquals( $expectedURL, $url ); - } - - public function testCancelPage() { - $this->setMwGlobals( array( - 'wgDonationInterfaceCancelPage' => 'Ways to give' - ) ); - $gateway = $this->getFreshGatewayObject(); - $url = ResultPages::getCancelPage( $gateway ); - $expectedTitle = Title::newFromText( 'Ways to give/en' ); - $this->assertEquals( $expectedTitle->getFullURL(), $url ); - } - - public function testCannotOverrideIp() { - $data = $this->getDonorTestData( 'FR' ); - unset( $data['country'] ); - $data['user_ip'] = '8.8.8.8'; - - $gateway = $this->getFreshGatewayObject( $data ); - $this->assertEquals( '127.0.0.1', $gateway->getData_Unstaged_Escaped( 'user_ip' ) ); - } - - public function testCanOverrideIpInBatchMode() { - $data = $this->getDonorTestData( 'FR' ); - unset( $data['country'] ); - $data['user_ip'] = '8.8.8.8'; - - $gateway = $this->getFreshGatewayObject( $data, array( 'batch_mode' => true ) ); - $this->assertEquals( '8.8.8.8', $gateway->getData_Unstaged_Escaped( 'user_ip' ) ); - } - - function testGetScoreName() { - $rule = array( - 'KeyMapA' => array( 'a','s','d','f','q','w','e','r','t' ), - 'KeyMapB' => array(), - 'GibberishWeight' => .9, - 'Score' => 10 - ); - $this->setMwGlobals( - array( 'wgDonationInterfaceNameFilterRules' => array( $rule ) ) - ); - $init = $this->getDonorTestData(); - $init['fname'] = 'asdf'; - $init['lname'] = 'qwert'; - - $gateway = $this->getFreshGatewayObject( $init ); - $result = $gateway->getScoreName(); - $this->assertNotEquals( 0, $result, 'Bad name not detected'); - } - - public function TestSetValidationAction() { - $data = $this->getDonorTestData( 'FR' ); - $gateway = $this->getFreshGatewayObject( $data ); - $gateway->setValidationAction( 'process' ); - $this->assertEquals( 'process', $gateway->getValidationAction(), 'Setup failed' ); - $gateway->setValidationAction( 'reject' ); - $this->assertEquals( 'reject', $gateway->getValidationAction(), 'Unable to escalate action' ); - $gateway->setValidationAction( 'process' ); - $this->assertEquals( 'reject', $gateway->getValidationAction(), 'De-escalating action without reset!' ); - } -} - ->>>>>>> BRANCH (4a92bf Configurable queue mirroring) diff --git a/tests/Adapter/GlobalCollect/GlobalCollectFormLoadTest.php b/tests/Adapter/GlobalCollect/GlobalCollectFormLoadTest.php deleted file mode 100644 index 39317c6..0000000 --- a/tests/Adapter/GlobalCollect/GlobalCollectFormLoadTest.php +++ /dev/null @@ -1,274 +0,0 @@ -<<<<<<< HEAD (226ee4 Make RapidFail rapid, avoid redirect loop) -======= -<?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 GlobalCollect - */ -class GlobalCollectFormLoadTest extends DonationInterfaceTestCase { - public function setUp() { - parent::setUp(); - - $vmad_countries = array( 'US', ); - $vmaj_countries = array( - 'AD', 'AT', 'AU', 'BE', 'BH', 'DE', 'EC', 'ES', 'FI', 'FR', 'GB', - 'GF', 'GR', 'HK', 'IE', 'IT', 'JP', 'KR', 'LU', 'MY', 'NL', 'PR', - 'PT', 'SG', 'SI', 'SK', 'TH', 'TW', - ); - $vma_countries = array( - 'AE', 'AL', 'AN', 'AR', 'BG', 'CA', 'CH', 'CN', 'CR', 'CY', 'CZ', 'DK', - 'DZ', 'EE', 'EG', 'JO', 'KE', 'HR', 'HU', 'IL', 'KW', 'KZ', 'LB', 'LI', - 'LK', 'LT', 'LV', 'MA', 'MT', 'NO', 'NZ', 'OM', 'PK', 'PL', 'QA', 'RO', - 'RU', 'SA', 'SE', 'TN', 'TR', 'UA', - ); - $this->setMwGlobals( array( - 'wgGlobalCollectGatewayEnabled' => true, - 'wgDonationInterfaceAllowedHtmlForms' => array( - 'cc-vmad' => array( - 'gateway' => 'globalcollect', - 'payment_methods' => array('cc' => array( 'visa', 'mc', 'amex', 'discover' )), - 'countries' => array( - '+' => $vmad_countries, - ), - ), - 'cc-vmaj' => array( - 'gateway' => 'globalcollect', - 'payment_methods' => array('cc' => array( 'visa', 'mc', 'amex', 'jcb' )), - 'countries' => array( - '+' => $vmaj_countries, - ), - ), - 'cc-vma' => array( - 'gateway' => 'globalcollect', - 'payment_methods' => array('cc' => array( 'visa', 'mc', 'amex' )), - 'countries' => array( - // Array merge with cc-vmaj as fallback in case 'j' goes down - // Array merge with cc-vmad as fallback in case 'd' goes down - '+' => array_merge( - $vmaj_countries, - $vmad_countries, - $vma_countries - ), - ), - ), - 'rtbt-sofo' => array( - 'gateway' => 'globalcollect', - 'countries' => array( - '+' => array( 'AT', 'BE', 'CH', 'DE' ), - '-' => 'GB' - ), - 'currencies' => array( '+' => 'EUR' ), - 'payment_methods' => array('rtbt' => 'rtbt_sofortuberweisung'), - ), - ), - ) ); - } - - public function testGCFormLoad() { - $init = $this->getDonorTestData( 'US' ); - unset( $init['order_id'] ); - $init['payment_method'] = 'cc'; - $init['payment_submethod'] = 'visa'; - $init['ffname'] = 'cc-vmad'; - - $assertNodes = array ( - 'submethod-mc' => array ( - 'nodename' => 'input' - ), - 'selected-amount' => array ( - 'nodename' => 'span', - 'innerhtmlmatches' => '/^\s*' . - str_replace( '$', '\$', - Amount::format( 1.55, 'USD', $init['language'] . '_' . $init['country'] ) - ). - '\s*$/', - ), - 'state' => array ( - 'nodename' => 'select', - 'selected' => 'CA', - ), - ); - - $this->verifyFormOutput( 'GlobalCollectGateway', $init, $assertNodes, true ); - } - - function testGCFormLoad_FR() { - $init = $this->getDonorTestData( 'FR' ); - unset( $init['order_id'] ); - $init['payment_method'] = 'cc'; - $init['payment_submethod'] = 'visa'; - $init['ffname'] = 'cc-vmaj'; - - $assertNodes = array ( - 'selected-amount' => array ( - 'nodename' => 'span', - 'innerhtmlmatches' => '/^\s*' . - Amount::format( 1.55, 'EUR', $init['language'] . '_' . $init['country'] ) . - '\s*$/', - ), - 'fname' => array ( - 'nodename' => 'input', - 'value' => 'Prénom', - ), - 'lname' => array ( - 'nodename' => 'input', - 'value' => 'Nom', - ), - 'country' => array ( - 'nodename' => 'input', - 'value' => 'FR', - ), - ); - - $this->verifyFormOutput( 'GlobalCollectGateway', $init, $assertNodes, true ); - } - - /** - * Ensure that form loads for Italy - */ - public function testGlobalCollectFormLoad_IT() { - $init = $this->getDonorTestData( 'IT' ); - unset( $init['order_id'] ); - $init['payment_method'] = 'cc'; - $init['payment_submethod'] = 'visa'; - $init['ffname'] = 'cc-vmaj'; - - $assertNodes = array ( - 'selected-amount' => array ( - 'nodename' => 'span', - 'innerhtmlmatches' => '/^\s*' . - Amount::format( 1.55, 'EUR', $init['language'] . '_' . $init['country'] ) . - '\s*$/', - ), - 'fname' => array ( - 'nodename' => 'input', - 'placeholder' => wfMessage( 'donate_interface-donor-fname')->inLanguage( 'it' )->text(), - ), - 'lname' => array ( - 'nodename' => 'input', - 'placeholder' => wfMessage( 'donate_interface-donor-lname')->inLanguage( 'it' )->text(), - ), - 'informationsharing' => array ( - 'nodename' => 'p', - 'innerhtml' => wfMessage( 'donate_interface-informationsharing', '.*' )->inLanguage( 'it' )->text(), - ), - 'country' => array ( - 'nodename' => 'input', - 'value' => 'IT', - ), - ); - - $this->verifyFormOutput( 'GlobalCollectGateway', $init, $assertNodes, true ); - } - - /** - * Make sure Belgian form loads in all of that country's supported languages - * @dataProvider belgiumLanguageProvider - */ - public function testGlobalCollectFormLoad_BE( $language ) { - $init = $this->getDonorTestData( 'BE' ); - unset( $init['order_id'] ); - $init['payment_method'] = 'cc'; - $init['payment_submethod'] = 'visa'; - $init['ffname'] = 'cc-vmaj'; - $init['language'] = $language; - - $assertNodes = array ( - 'selected-amount' => array ( - 'nodename' => 'span', - 'innerhtmlmatches' => '/^\s*' . - Amount::format( 1.55, 'EUR', $init['language'] . '_' . $init['country'] ) . - '\s*$/', - ), - 'fname' => array ( - 'nodename' => 'input', - 'placeholder' => wfMessage( 'donate_interface-donor-fname')->inLanguage( $language )->text(), - ), - 'lname' => array ( - 'nodename' => 'input', - 'placeholder' => wfMessage( 'donate_interface-donor-lname')->inLanguage( $language )->text(), - ), - 'informationsharing' => array ( - 'nodename' => 'p', - 'innerhtml' => wfMessage( 'donate_interface-informationsharing', '.*' )->inLanguage( $language )->text(), - ), - 'country' => array ( - 'nodename' => 'input', - 'value' => 'BE', - ), - ); - - $this->verifyFormOutput( 'GlobalCollectGateway', $init, $assertNodes, true ); - } - - /** - * Make sure Canadian CC form loads in English and French - * @dataProvider canadaLanguageProvider - */ - public function testGlobalCollectFormLoad_CA( $language ) { - $init = $this->getDonorTestData( 'CA' ); - unset( $init['order_id'] ); - $init['payment_method'] = 'cc'; - $init['payment_submethod'] = 'visa'; - $init['ffname'] = 'cc-vma'; - $init['language'] = $language; - $locale = $language . '_CA'; - - $assertNodes = array ( - 'selected-amount' => array ( - 'nodename' => 'span', - 'innerhtmlmatches' => '/^\s*' . - str_replace( '$', '\$', - Amount::format( 1.55, 'CAD', $init['language'] . '_' . $init['country'] ) - ) . - '\s*$/', - ), - 'fname' => array ( - 'nodename' => 'input', - 'placeholder' => wfMessage( 'donate_interface-donor-fname')->inLanguage( $language )->text(), - ), - 'lname' => array ( - 'nodename' => 'input', - 'placeholder' => wfMessage( 'donate_interface-donor-lname')->inLanguage( $language )->text(), - ), - 'informationsharing' => array ( - 'nodename' => 'p', - 'innerhtml' => wfMessage( 'donate_interface-informationsharing', '.*' )->inLanguage( $language )->text(), - ), - 'state' => array ( - 'nodename' => 'select', - 'selected' => 'SK', - ), - 'zip' => array ( - 'nodename' => 'input', - 'value' => $init['zip'], - ), - 'country' => array ( - 'nodename' => 'input', - 'value' => 'CA', - ), - ); - - $this->verifyFormOutput( 'GlobalCollectGateway', $init, $assertNodes, true ); - } -} ->>>>>>> BRANCH (4a92bf Configurable queue mirroring) diff --git a/tests/Adapter/GlobalCollect/GlobalCollectOrphanAdapterTest.php b/tests/Adapter/GlobalCollect/GlobalCollectOrphanAdapterTest.php deleted file mode 100644 index 5356682..0000000 --- a/tests/Adapter/GlobalCollect/GlobalCollectOrphanAdapterTest.php +++ /dev/null @@ -1,194 +0,0 @@ -<<<<<<< HEAD (226ee4 Make RapidFail rapid, avoid redirect loop) -======= -<?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 GlobalCollect - * @group OrphanSlayer - */ -class DonationInterface_Adapter_GlobalCollect_Orphans_GlobalCollectTest extends DonationInterfaceTestCase { - public function setUp() { - parent::setUp(); - - $this->setMwGlobals( array( - 'wgGlobalCollectGatewayEnabled' => true, - 'wgDonationInterfaceAllowedHtmlForms' => array( - 'cc-vmad' => array( - 'gateway' => 'globalcollect', - 'payment_methods' => array('cc' => array( 'visa', 'mc', 'amex', 'discover' )), - 'countries' => array( - '+' => array( 'US', ), - ), - ), - ), - ) ); - } - - /** - * @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 = 'TestingGlobalCollectOrphanAdapter'; - $this->dummy_utm_data = array ( - 'utm_source' => 'dummy_source', - 'utm_campaign' => 'dummy_campaign', - 'utm_medium' => 'dummy_medium', - 'date' => time(), - ); - } - - public function testConstructor() { - - $options = $this->getDonorTestData(); - $class = $this->testAdapterClass; - - $gateway = $this->getFreshGatewayObject(); - - $this->assertInstanceOf( $class, $gateway ); - - $this->verifyNoLogErrors(); - } - - - public function testBatchOrderID_generate() { - - //no data on construct, generate Order IDs - $gateway = $this->getFreshGatewayObject( null, array ( 'order_id_meta' => array ( 'generate' => TRUE ) ) ); - $this->assertTrue( $gateway->getOrderIDMeta( 'generate' ), 'The order_id meta generate setting override is not working properly. Order_id generation may be broken.' ); - $this->assertNotNull( $gateway->getData_Unstaged_Escaped( 'order_id' ), 'Failed asserting that an absent order id is not left as null, when generating our own' ); - - $data = array_merge( $this->getDonorTestData(), $this->dummy_utm_data ); - $data['order_id'] = '55555'; - - //now, add data and check that we didn't kill the oid. Still generating. - $gateway->loadDataAndReInit( $data, $useDB = false ); - $this->assertEquals( $gateway->getData_Unstaged_Escaped( 'order_id' ), '55555', 'loadDataAndReInit failed to stick OrderID' ); - - $data['order_id'] = '444444'; - $gateway->loadDataAndReInit( $data, $useDB = false ); - $this->assertEquals( $gateway->getData_Unstaged_Escaped( 'order_id' ), '444444', 'loadDataAndReInit failed to stick OrderID' ); - - $this->verifyNoLogErrors(); - } - - public function testBatchOrderID_no_generate() { - - //no data on construct, do not generate Order IDs - $gateway = $this->getFreshGatewayObject( null, array ( 'order_id_meta' => array ( 'generate' => FALSE ) ) ); - $this->assertFalse( $gateway->getOrderIDMeta( 'generate' ), 'The order_id meta generate setting override is not working properly. Deferred order_id generation may be broken.' ); - $this->assertNull( $gateway->getData_Unstaged_Escaped( 'order_id' ), 'Failed asserting that an absent order id is left as null, when not generating our own' ); - - $data = array_merge( $this->getDonorTestData(), $this->dummy_utm_data ); - $data['order_id'] = '66666'; - - //now, add data and check that we didn't kill the oid. Still not generating - $gateway->loadDataAndReInit( $data, $useDB = false ); - $this->assertEquals( $gateway->getData_Unstaged_Escaped( 'order_id' ), '66666', 'loadDataAndReInit failed to stick OrderID' ); - - $data['order_id'] = '777777'; - $gateway->loadDataAndReInit( $data, $useDB = false ); - $this->assertEquals( $gateway->getData_Unstaged_Escaped( 'order_id' ), '777777', 'loadDataAndReInit failed to stick OrderID on second batch item' ); - - $this->verifyNoLogErrors(); - } - - public function testGCFormLoad() { - $init = $this->getDonorTestData( 'US' ); - unset( $init['order_id'] ); - $init['payment_method'] = 'cc'; - $init['payment_submethod'] = 'visa'; - $init['ffname'] = 'cc-vmad'; - - $assertNodes = array ( - 'submethod-mc' => array ( - 'nodename' => 'input' - ), - 'selected-amount' => array ( - 'nodename' => 'span', - 'innerhtmlmatches' => '/^\s*' . - str_replace( '$', '\$', - Amount::format( 1.55, 'USD', $init['language'] . '_' . $init['country'] ) - ). - '\s*$/', - ), - 'state' => array ( - 'nodename' => 'select', - 'selected' => 'CA', - ), - ); - - $this->verifyFormOutput( 'GlobalCollectGateway', $init, $assertNodes, true ); - } - - /** - * Tests to make sure that certain error codes returned from GC will - * trigger order cancellation, even if retryable errors also exist. - * @dataProvider mcNoRetryCodeProvider - */ - public function testNoMastercardFinesForRepeatOnBadCodes( $code ) { - $gateway = $this->getFreshGatewayObject( null, array ( 'order_id_meta' => array ( 'generate' => FALSE ) ) ); - - //Toxic card should not retry, even if there's an order id collision - $init = array_merge( $this->getDonorTestData(), $this->dummy_utm_data ); - $init['ffname'] = 'cc-vmad'; - $init['order_id'] = '55555'; - $init['email'] = 'innoc...@clean.com'; - $gateway->loadDataAndReInit( $init, $useDB = false ); - - $gateway->setDummyGatewayResponseCode( $code ); - $result = $gateway->do_transaction( 'Confirm_CreditCard' ); - $this->assertEquals( 1, count( $gateway->curled ), "Gateway kept trying even with response code $code! MasterCard could fine us a thousand bucks for that!" ); - $this->assertEquals( false, $result->getCommunicationStatus(), "Error code $code should mean status of do_transaction is false" ); - $errors = $result->getErrors(); - $this->assertFalse( empty( $errors ), 'Orphan adapter needs to see the errors to consider it rectified' ); - $this->assertTrue( array_key_exists( '1000001', $errors ), 'Orphan adapter needs error 1000001 to consider it rectified' ); - $loglines = $this->getLogMatches( LogLevel::INFO, "/Got error code $code, not retrying to avoid MasterCard fines./" ); - $this->assertNotEmpty( $loglines, "GC Error $code is not generating the expected payments log error" ); - } - - /** - * Don't fraud-fail someone for bad CVV if GET_ORDERSTATUS - * comes back with STATUSID 25 and no CVVRESULT - * @group CvvResult - */ - function testConfirmCreditCardStatus25() { - $gateway = $this->getFreshGatewayObject( null, array ( 'order_id_meta' => array ( 'generate' => FALSE ) ) ); - - $init = array_merge( $this->getDonorTestData(), $this->dummy_utm_data ); - $init['ffname'] = 'cc-vmad'; - $init['order_id'] = '55555'; - $init['email'] = 'innoc...@clean.com'; - - $gateway->loadDataAndReInit( $init, $useDB = false ); - $gateway->setDummyGatewayResponseCode( '25' ); - - $gateway->do_transaction( 'Confirm_CreditCard' ); - $action = $gateway->getValidationAction(); - $this->assertEquals( 'process', $action, 'Gateway should not fraud fail on STATUSID 25' ); - } -} ->>>>>>> BRANCH (4a92bf Configurable queue mirroring) diff --git a/tests/Adapter/GlobalCollect/RealTimeBankTransferIdealTest.php b/tests/Adapter/GlobalCollect/RealTimeBankTransferIdealTest.php deleted file mode 100644 index 5d391f6..0000000 --- a/tests/Adapter/GlobalCollect/RealTimeBankTransferIdealTest.php +++ /dev/null @@ -1,346 +0,0 @@ -<<<<<<< HEAD (226ee4 Make RapidFail rapid, avoid redirect loop) -======= -<?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 GlobalCollect - * @group RealTimeBankTransfer - */ -class DonationInterface_Adapter_GlobalCollect_RealTimeBankTransferIdealTest extends DonationInterfaceTestCase { - public function setUp() { - parent::setUp(); - - $this->setMwGlobals( array( - 'wgGlobalCollectGatewayEnabled' => true, - 'wgDonationInterfaceAllowedHtmlForms' => array( - 'rtbt-ideal' => array( - 'gateway' => 'globalcollect', - 'payment_methods' => array('rtbt' => 'rtbt_ideal'), - 'countries' => array( '+' => 'NL' ), - 'currencies' => array( '+' => 'EUR' ), - ), - ), - ) ); - } - - /** - * Test for ideal form loading - */ - public function testGCFormLoad_rtbt_Ideal() { - $init = $this->getDonorTestData( 'NL' ); - unset( $init['order_id'] ); - $init['payment_method'] = 'rtbt'; - $init['ffname'] = 'rtbt-ideal'; - - $assertNodes = array ( - //can't do the selected-amount test here, because apparently javascript. So... - - 'amount' => array ( - 'nodename' => 'input', - 'value' => '1.55', - ), - 'currency_code' => array ( - 'nodename' => 'select', - 'selected' => 'EUR', - ), - 'country' => array ( - 'nodename' => 'input', - 'value' => 'NL', - ), - ); - - $this->verifyFormOutput( 'GlobalCollectGateway', $init, $assertNodes, true ); - } - - /** - * testBuildRequestXmlWithIssuerId21 - * - * Rabobank: 21 - * - * @covers GatewayAdapter::__construct - * @covers GatewayAdapter::setCurrentTransaction - * @covers GatewayAdapter::buildRequestXML - * @covers GatewayAdapter::getData_Unstaged_Escaped - */ - public function testBuildRequestXmlWithIssuerId21() { - - $optionsForTestData = array( - 'form_name' => 'TwoStepAmount', - 'payment_method' => 'rtbt', - 'payment_submethod' => 'rtbt_ideal', - 'payment_product_id' => 809, - 'issuer_id' => 21, - ); - - //somewhere else? - $options = $this->getDonorTestData( 'ES' ); - $options = array_merge( $options, $optionsForTestData ); - unset( $options['payment_product_id'] ); - - $this->buildRequestXmlForGlobalCollect( $optionsForTestData, $options ); - } - - /** - * testBuildRequestXmlWithIssuerId31 - * - * ABN AMRO: 31 - * - * @covers GatewayAdapter::__construct - * @covers GatewayAdapter::setCurrentTransaction - * @covers GatewayAdapter::buildRequestXML - * @covers GatewayAdapter::getData_Unstaged_Escaped - */ - public function testBuildRequestXmlWithIssuerId31() { - - $optionsForTestData = array( - 'form_name' => 'TwoStepAmount', - 'payment_method' => 'rtbt', - 'payment_submethod' => 'rtbt_ideal', - 'payment_product_id' => 809, - 'issuer_id' => 31, - ); - - //somewhere else? - $options = $this->getDonorTestData( 'ES' ); - $options = array_merge( $options, $optionsForTestData ); - unset( $options['payment_product_id'] ); - - $this->buildRequestXmlForGlobalCollect( $optionsForTestData, $options ); - } - - /** - * testBuildRequestXmlWithIssuerId91 - * - * Rabobank: 21 - * - * @covers GatewayAdapter::__construct - * @covers GatewayAdapter::setCurrentTransaction - * @covers GatewayAdapter::buildRequestXML - * @covers GatewayAdapter::getData_Unstaged_Escaped - */ - public function testBuildRequestXmlWithIssuerId91() { - - $optionsForTestData = array( - 'form_name' => 'TwoStepAmount', - 'payment_method' => 'rtbt', - 'payment_submethod' => 'rtbt_ideal', - 'payment_product_id' => 809, - 'issuer_id' => 21, - ); - - //somewhere else? - $options = $this->getDonorTestData( 'ES' ); - $options = array_merge( $options, $optionsForTestData ); - unset( $options['payment_product_id'] ); - - $this->buildRequestXmlForGlobalCollect( $optionsForTestData, $options ); - } - - /** - * testBuildRequestXmlWithIssuerId161 - * - * Van Lanschot Bankiers: 161 - * - * @covers GatewayAdapter::__construct - * @covers GatewayAdapter::setCurrentTransaction - * @covers GatewayAdapter::buildRequestXML - * @covers GatewayAdapter::getData_Unstaged_Escaped - */ - public function testBuildRequestXmlWithIssuerId161() { - - $optionsForTestData = array( - 'form_name' => 'TwoStepAmount', - 'payment_method' => 'rtbt', - 'payment_submethod' => 'rtbt_ideal', - 'payment_product_id' => 809, - 'issuer_id' => 161, - ); - - //somewhere else? - $options = $this->getDonorTestData( 'ES' ); - $options = array_merge( $options, $optionsForTestData ); - unset( $options['payment_product_id'] ); - - $this->buildRequestXmlForGlobalCollect( $optionsForTestData, $options ); - } - - /** - * testBuildRequestXmlWithIssuerId511 - * - * Triodos Bank: 511 - * - * @covers GatewayAdapter::__construct - * @covers GatewayAdapter::setCurrentTransaction - * @covers GatewayAdapter::buildRequestXML - * @covers GatewayAdapter::getData_Unstaged_Escaped - */ - public function testBuildRequestXmlWithIssuerId511() { - - $optionsForTestData = array( - 'form_name' => 'TwoStepAmount', - 'payment_method' => 'rtbt', - 'payment_submethod' => 'rtbt_ideal', - 'payment_product_id' => 809, - 'issuer_id' => 511, - ); - - //somewhere else? - $options = $this->getDonorTestData( 'ES' ); - $options = array_merge( $options, $optionsForTestData ); - unset( $options['payment_product_id'] ); - - $this->buildRequestXmlForGlobalCollect( $optionsForTestData, $options ); - } - - /** - * testBuildRequestXmlWithIssuerId721 - * - * ING: 721 - * - * @covers GatewayAdapter::__construct - * @covers GatewayAdapter::setCurrentTransaction - * @covers GatewayAdapter::buildRequestXML - * @covers GatewayAdapter::getData_Unstaged_Escaped - */ - public function testBuildRequestXmlWithIssuerId721() { - - $optionsForTestData = array( - 'form_name' => 'TwoStepAmount', - 'payment_method' => 'rtbt', - 'payment_submethod' => 'rtbt_ideal', - 'payment_product_id' => 809, - 'issuer_id' => 721, - ); - - //somewhere else? - $options = $this->getDonorTestData( 'ES' ); - $options = array_merge( $options, $optionsForTestData ); - unset( $options['payment_product_id'] ); - - $this->buildRequestXmlForGlobalCollect( $optionsForTestData, $options ); - } - - /** - * testBuildRequestXmlWithIssuerId751 - * - * SNS Bank: 751 - * - * @covers GatewayAdapter::__construct - * @covers GatewayAdapter::setCurrentTransaction - * @covers GatewayAdapter::buildRequestXML - * @covers GatewayAdapter::getData_Unstaged_Escaped - */ - public function testBuildRequestXmlWithIssuerId751() { - - $optionsForTestData = array( - 'form_name' => 'TwoStepAmount', - 'payment_method' => 'rtbt', - 'payment_submethod' => 'rtbt_ideal', - 'payment_product_id' => 809, - 'issuer_id' => 751, - ); - - //somewhere else? - $options = $this->getDonorTestData( 'ES' ); - $options = array_merge( $options, $optionsForTestData ); - unset( $options['payment_product_id'] ); - - $this->buildRequestXmlForGlobalCollect( $optionsForTestData, $options ); - } - - /** - * testBuildRequestXmlWithIssuerId761 - * - * ASN Bank: 761 - * - * @covers GatewayAdapter::__construct - * @covers GatewayAdapter::setCurrentTransaction - * @covers GatewayAdapter::buildRequestXML - * @covers GatewayAdapter::getData_Unstaged_Escaped - */ - public function testBuildRequestXmlWithIssuerId761() { - - $optionsForTestData = array( - 'form_name' => 'TwoStepAmount', - 'payment_method' => 'rtbt', - 'payment_submethod' => 'rtbt_ideal', - 'payment_product_id' => 809, - 'issuer_id' => 761, - ); - - //somewhere else? - $options = $this->getDonorTestData( 'ES' ); - $options = array_merge( $options, $optionsForTestData ); - unset( $options['payment_product_id'] ); - - $this->buildRequestXmlForGlobalCollect( $optionsForTestData, $options ); - } - - /** - * testBuildRequestXmlWithIssuerId771 - * - * RegioBank: 771 - * - * @covers GatewayAdapter::__construct - * @covers GatewayAdapter::setCurrentTransaction - * @covers GatewayAdapter::buildRequestXML - * @covers GatewayAdapter::getData_Unstaged_Escaped - */ - public function testBuildRequestXmlWithIssuerId771() { - - $optionsForTestData = array( - 'form_name' => 'TwoStepAmount', - 'payment_method' => 'rtbt', - 'payment_submethod' => 'rtbt_ideal', - 'payment_product_id' => 809, - 'issuer_id' => 771, - ); - - //somewhere else? - $options = $this->getDonorTestData( 'ES' ); - $options = array_merge( $options, $optionsForTestData ); - unset( $options['payment_product_id'] ); - - $this->buildRequestXmlForGlobalCollect( $optionsForTestData, $options ); - } - - public function testFormAction() { - - $optionsForTestData = array ( - 'payment_method' => 'rtbt', - 'payment_submethod' => 'rtbt_ideal', - 'issuer_id' => 771, - ); - - //somewhere else? - $options = $this->getDonorTestData( 'ES' ); - $options = array_merge( $options, $optionsForTestData ); - - $this->gatewayAdapter = $this->getFreshGatewayObject( $options ); - $this->gatewayAdapter->do_transaction( "INSERT_ORDERWITHPAYMENT" ); - $action = $this->gatewayAdapter->getTransactionDataFormAction(); - $this->assertEquals( "url_placeholder", $action, "The formaction was not populated as expected (ideal)." ); - } - -} - ->>>>>>> BRANCH (4a92bf Configurable queue mirroring) diff --git a/tests/DonationInterfaceTestCase.php b/tests/DonationInterfaceTestCase.php deleted file mode 100644 index 8d7cda1..0000000 --- a/tests/DonationInterfaceTestCase.php +++ /dev/null @@ -1,694 +0,0 @@ -<<<<<<< HEAD (226ee4 Make RapidFail rapid, avoid redirect loop) -======= -<?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 QueueHandling - * @group ClassMethod - * @group ListenerAdapter - * - * @category UnitTesting - * @package Fundraising_QueueHandling - */ -abstract class DonationInterfaceTestCase extends MediaWikiTestCase { - protected $backupGlobalsBlacklist = array( - 'wgHooks', - ); - - /** - * An array of the vars we expect to be set before people hit payments. - * @var array - */ - public static $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; - - /** - * @var TestingDonationLogger - */ - protected $testLogger; - protected $testAdapterClass = TESTS_ADAPTER_DEFAULT; - - /** - * @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; - - parent::__construct( $name, $data, $dataName ); - } - - protected function setUp() { - $this->testLogger = new TestingDonationLogger(); - DonationLoggerFactory::$overrideLogger = $this->testLogger; - parent::setUp(); - } - - protected function tearDown() { - $this->resetAllEnv(); - DonationLoggerFactory::$overrideLogger = null; - parent::tearDown(); - } - - /** - * Set up a fake request with the given data. Returns the fake request. - * @param array $data - * @param array $session - * @return FauxRequest - */ - protected function setUpRequest( $data, $session = null ) { - RequestContext::resetMain(); - $request = new FauxRequest( $data, false, $session ); - RequestContext::getMain()->setRequest( $request ); - return $request; - } - - /** - * Set global language for the duration of the test - * - * @param string $language language code to force - */ - protected function setLanguage( $language ) { - RequestContext::getMain()->setLanguage( $language ); - // BackCompat - $this->setMwGlobals( 'wgLang', RequestContext::getMain()->getLanguage() ); - } - - /** - * 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->setUpRequest( $options ); - $this->gatewayAdapter = new TestingGlobalCollectAdapter(); - - $this->gatewayAdapter->setCurrentTransaction('INSERT_ORDERWITHPAYMENT'); - - $exposed = TestingAccessWrapper::newFromObject( $this->gatewayAdapter ); - $request = trim( $exposed->buildRequestXML() ); - - $this->setUpRequest( $options ); - $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 OutOfBoundsException when there is no data available for the requested country - */ - public static 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', - 'email' => 'nob...@wikimedia.org', - ), - 'ES' => array ( - 'city' => 'Barcelona', - 'state' => 'XX', - 'zip' => '0', - 'currency_code' => 'EUR', - 'street' => '123 Calle Fake', - 'fname' => 'Nombre', - 'lname' => 'Apellido', - 'amount' => '1.55', - 'language' => 'es', - ), - 'Catalonia' => array ( - 'city' => 'Barcelona', - 'state' => 'XX', - 'zip' => '0', - 'currency_code' => 'EUR', - 'street' => '123 Calle Fake', - 'fname' => 'Nombre', - 'lname' => 'Apellido', - 'amount' => '1.55', - 'language' => 'ca', - ), - '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', - ), - 'BR' => array ( - 'currency_code' => 'BRL', - 'fiscal_number' => '00003456789', - 'payment_submethod' => 'test_bank', - 'fname' => 'Nome', - 'lname' => 'Apelido', - 'amount' => '100', - 'language' => 'pt', - 'email' => 'nob...@example.org' - ), - 'MX' => array ( - 'city' => 'Tuxtla Gutiérrez', - 'state' => 'CHP', - 'currency_code' => 'MXN', - 'street' => 'Calle Falso 123', - 'fname' => 'Nombre', - 'lname' => 'Apellido', - 'email' => 'pue...@unido.coop', - 'amount' => '155', - 'language' => 'es', - ), - ); - //default to US - if ( $country === '' ) { - $country = 'US'; - } - - if ( array_key_exists( $country, $donortestdata ) ) { - $donortestdata = array_merge( self::$initial_vars, $donortestdata[$country] ); - $donortestdata['country'] = $country; - return $donortestdata; - } - throw new OutOfBoundsException( __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 $wgDonationInterfaceThankYouPage; - $request = RequestContext::getMain()->getRequest(); - - $orderId = $this->gatewayAdapter->getData_Unstaged_Escaped( 'order_id' ); - $exposed = TestingAccessWrapper::newFromObject( $this->gatewayAdapter ); - $merchantref = $exposed->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>' . $exposed->account_config[ 'MerchantID' ] . '</MERCHANTID>'; - - if ( isset( $request ) ) { - $expected .= '<IPADDRESS>' . $request->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( $request ) ) { - $expected .= '<IPADDRESSCUSTOMER>' . $request->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']}?country={$options['country']}</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 .= '<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 .= '<DATECOLLECT>' . gmdate( 'Ymd' ) . '</DATECOLLECT>'; //is this cheating? Probably. - $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 GatewayAdapter 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 ); - - $classReflection = new ReflectionClass( $gateway ); - - // 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 ) { - if ( property_exists( $class, $field ) ) { - $propertyReflection = $classReflection->getProperty( $field ); - $propertyReflection->setAccessible( true ); - $propertyReflection->setValue( $gateway, $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__; - - RequestContext::resetMain(); - - // Wipe out the $instance of these classes to make sure they're - // re-created with fresh gateway instances for the next test - $singleton_classes = array( - 'Gateway_Extras_ConversionLog', - 'Gateway_Extras_CustomFilters', - 'Gateway_Extras_CustomFilters_Functions', - 'Gateway_Extras_CustomFilters_IP_Velocity', - 'Gateway_Extras_CustomFilters_MinFraud', - 'Gateway_Extras_CustomFilters_Referrer', - 'Gateway_Extras_CustomFilters_Source', - 'Gateway_Extras_SessionVelocityFilter', - ); - foreach( $singleton_classes as $singleton_class ) { - $unwrapped = TestingAccessWrapper::newFromClass( $singleton_class ); - $unwrapped->instance = null; - } - } - - /** - * 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 string $special_page_class A testing descendant of GatewayPage - * @param array $initial_vars Array that will be loaded straight into a - * test version of the http request. - * @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. - * @param array $session pre-existing session data. - */ - function verifyFormOutput( $special_page_class, $initial_vars, $perform_these_checks, $fail_on_log_errors = false, $session = null ) { - // Nasty hack to clear output from any previous tests. - $mainContext = RequestContext::getMain(); - $newOutput = new OutputPage( $mainContext ); - $newRequest = new TestingRequest( $initial_vars, false, $session ); - $newTitle = Title::newFromText( 'nonsense is apparently fine' ); - $mainContext->setRequest( $newRequest ); - $mainContext->setOutput( $newOutput ); - $mainContext->setTitle( $newTitle ); - - $globals = array ( - 'wgTitle' => $newTitle, - '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(); - } - - $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] ) ); - } - } - - /** - * 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 there are no log entries of LOG_ERR or worse. - */ - function verifyNoLogErrors( ) { - $log = $this->testLogger->messages; - - $this->assertTrue( is_array( $log ), "Missing the test log" ); - - //for our purposes, an "error" is LOG_ERR or less. - $checklogs = array ( - LogLevel::ERROR => "Oops: We've got LOG_ERRors.", - LogLevel::CRITICAL => "Critical errors!", - LogLevel::ALERT => "Log Alerts!", - LogLevel::EMERGENCY => "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 string $log_level One of the constants in \Psr\Log\LogLevel - * @param string $match A regex to match against the log lines. - * @return array All log lines that match $match. - */ - public function getLogMatches( $log_level, $match ) { - $log = $this->testLogger->messages; - if ( !array_key_exists( $log_level, $log ) ) { - return false; - } - $return = array ( ); - foreach ( $log[$log_level] as $line ) { - if ( preg_match( $match, $line ) ) { - $return[] = $line; - } - } - return $return; - } - - static function getInnerHTML( $node ) { - $innerHTML = ''; - $children = $node->childNodes; - foreach ( $children as $child ) { - $innerHTML .= $child->ownerDocument->saveXML( $child ); - } - return $innerHTML; - } -} ->>>>>>> BRANCH (4a92bf Configurable queue mirroring) diff --git a/tests/DonationQueueTest.php b/tests/DonationQueueTest.php deleted file mode 100644 index 56cd6fc..0000000 --- a/tests/DonationQueueTest.php +++ /dev/null @@ -1,154 +0,0 @@ -<<<<<<< HEAD (226ee4 Make RapidFail rapid, avoid redirect loop) -======= -<?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 DonationInterface - * @group QueueHandling - * - * @category UnitTesting - * @package Fundraising_QueueHandling - */ -class DonationQueueTest extends DonationInterfaceTestCase { - protected $transaction; - protected $queue_name; - protected $expected_message; - - public function setUp() { - parent::setUp(); - - $this->queue_name = 'test-' . mt_rand(); - - $this->setMwGlobals( array( - 'wgDonationInterfaceEnableQueue' => true, - 'wgDonationInterfaceDefaultQueueServer' => array( - 'type' => 'TestingQueue', - ), - 'wgDonationInterfaceQueues' => array( - $this->queue_name => array(), - ), - ) ); - - $this->transaction = array( - 'amount' => '1.24', - 'city' => 'Dunburger', - 'contribution_tracking_id' => mt_rand(), - // FIXME: err, we're cheating normalization here. - 'correlation-id' => 'testgateway-' . mt_rand(), - 'country' => 'US', - 'currency_code' => 'USD', - 'date' => time(), - 'email' => 'nob...@wikimedia.org', - 'fname' => 'Jen', - 'gateway_account' => 'default', - 'gateway' => 'testgateway', - 'gateway_txn_id' => mt_rand(), - 'order_id' => mt_rand(), - 'language' => 'en', - 'lname' => 'Russ', - 'payment_method' => 'cc', - 'payment_submethod' => 'visa', - 'php-message-class' => 'SmashPig\CrmLink\Messages\DonationInterfaceMessage', - 'response' => 'Gateway response something', - 'state' => 'AK', - 'street' => '1 Fake St.', - 'user_ip' => '127.0.0.1', - 'utm_source' => 'testing', - 'zip' => '12345', - ); - - $this->expected_message = array( - 'contribution_tracking_id' => $this->transaction['contribution_tracking_id'], - 'utm_source' => 'testing', - 'language' => 'en', - 'email' => 'nob...@wikimedia.org', - 'first_name' => 'Jen', - 'last_name' => 'Russ', - 'street_address' => '1 Fake St.', - 'city' => 'Dunburger', - 'state_province' => 'AK', - 'country' => 'US', - 'postal_code' => '12345', - 'gateway' => 'testgateway', - 'gateway_account' => 'default', - 'gateway_txn_id' => $this->transaction['gateway_txn_id'], - 'order_id' => $this->transaction['order_id'], - 'payment_method' => 'cc', - 'payment_submethod' => 'visa', - 'response' => 'Gateway response something', - 'currency' => 'USD', - 'fee' => '0', - 'gross' => '1.24', - 'user_ip' => '127.0.0.1', - 'date' => (int)$this->transaction['date'], - ); - } - - public function tearDown() { - // Clear static variables. - TestingQueue::clearAll(); - - parent::tearDown(); - } - - public function testPushMessage() { - DonationQueue::instance()->push( $this->transaction, $this->queue_name ); - - $this->assertEquals( $this->expected_message, - DonationQueue::instance()->pop( $this->queue_name ) ); - } - - /** - * After pushing 2, pop should return the first. - */ - public function testIsFifoQueue() { - DonationQueue::instance()->push( $this->transaction, $this->queue_name ); - - $transaction2 = $this->transaction; - $transaction2['correlation-id'] = mt_rand(); - - $this->assertEquals( $this->expected_message, - DonationQueue::instance()->pop( $this->queue_name ) ); - } - - public function testSetMessage() { - DonationQueue::instance()->set( $this->transaction['correlation-id'], - $this->transaction, $this->queue_name ); - - $this->assertEquals( $this->expected_message, - DonationQueue::instance()->get( - $this->transaction['correlation-id'], $this->queue_name ) ); - } - - public function testDeleteMessage() { - DonationQueue::instance()->set( $this->transaction['correlation-id'], - $this->transaction, $this->queue_name ); - $this->assertEquals( $this->expected_message, - DonationQueue::instance()->get( - $this->transaction['correlation-id'], $this->queue_name ) ); - - DonationQueue::instance()->delete( - $this->transaction['correlation-id'], $this->queue_name ); - - $this->assertNull( - DonationQueue::instance()->get( - $this->transaction['correlation-id'], $this->queue_name ) ); - } -} ->>>>>>> BRANCH (4a92bf Configurable queue mirroring) diff --git a/tests/GatewayValidationTest.php b/tests/GatewayValidationTest.php deleted file mode 100644 index 30e23e1..0000000 --- a/tests/GatewayValidationTest.php +++ /dev/null @@ -1,200 +0,0 @@ -<<<<<<< HEAD (226ee4 Make RapidFail rapid, avoid redirect loop) -======= -<?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( - // FIXME: base class sketchiness. - 'wgDonationInterfaceGatewayAdapters' => array( - 'donation' => 'TestingGatewayAdapter', - ), - 'wgDonationInterfacePriceFloor' => 2.00, - 'wgDonationInterfacePriceCeiling' => 100.00, - ) ); - - TestingGenericAdapter::$acceptedCurrencies[] = 'USD'; - - $this->page = new TestingGatewayPage(); - $this->adapter = new TestingGenericAdapter(); - $this->page->adapter = $this->adapter; - } - - public function tearDown() { - TestingGenericAdapter::$fakeIdentifier = null; - TestingGenericAdapter::$acceptedCurrencies = array(); - parent::tearDown(); - } - - public function testPassesValidation() { - $this->adapter->addRequestData( array( - 'amount' => '2.00', - 'country' => 'US', - 'currency' => 'USD', - 'email' => 'f...@localhost.net', - ) ); - - $this->page->validateForm(); - - $this->assertTrue( $this->adapter->validatedOK() ); - } - - public function testLowAmountError() { - $this->adapter->addRequestData( 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->addRequestData( 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->addRequestData( array( - 'amount' => '2.99', - 'country' => 'BR', - 'currency' => 'BRL', - ) ); - - $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->addRequestData( 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->addRequestData( array( - 'amount' => '2.99', - 'currency' => 'USD', - 'email' => 'foo', - ) ); - - $this->page->validateForm(); - - $this->assertFalse( $this->adapter->validatedOK() ); - - $errors = $this->adapter->getValidationErrors(); - $this->assertArrayHasKey( 'email', $errors ); - } - - public function testSpuriousCcError() { - $this->adapter->addRequestData( 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->addRequestData( array( - 'amount' => '2.99', - ) ); - - $this->page->validateForm(); - - $this->assertFalse( $this->adapter->validatedOK() ); - - $errors = $this->adapter->getValidationErrors(); - $this->assertArrayHasKey( 'currency_code', $errors ); - } - - /** - * @covers DataValidator::validate_gateway - */ - public function testBadGatewayError() { - $badGateway = uniqid(); - - // The gateway is calculated from adapter class, so this validation - // doesn't happen in practice and we can't fake a bad gateway using - // GatewayAdapter::addRequestData(). - - TestingGenericAdapter::$fakeIdentifier = $badGateway; - $this->adapter = new TestingGenericAdapter(); - $this->page->adapter = $this->adapter; - - $this->page->validateForm(); - - $this->assertFalse( $this->adapter->validatedOK() ); - - $errors = $this->adapter->getValidationErrors(); - $this->assertArrayHasKey( 'general', $errors ); - } -} ->>>>>>> BRANCH (4a92bf Configurable queue mirroring) diff --git a/tests/TestConfiguration.php b/tests/TestConfiguration.php deleted file mode 100644 index 672a5ce..0000000 --- a/tests/TestConfiguration.php +++ /dev/null @@ -1,176 +0,0 @@ -<<<<<<< HEAD (226ee4 Make RapidFail rapid, avoid redirect loop) -======= -<?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', 'nob...@wikimedia.org' ); - -/** - * 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, - $wgDonationInterfaceGatewayAdapters, - $wgDonationInterfaceAllowedHtmlForms, - $wgDonationInterfaceThankYouPage, - $wgGlobalCollectGatewayAccountInfo, - $wgPaypalGatewayAccountInfo, - $wgPaypalGatewayReturnURL, - $wgAmazonGatewayReturnURL, - $wgAmazonGatewayAccountInfo, - $wgAdyenGatewayURL, - $wgAdyenGatewayAccountInfo, - $wgAstroPayGatewayURL, - $wgAstroPayGatewayTestingURL, - $wgAstroPayGatewayAccountInfo, - $wgAstroPayGatewayFallbackCurrency, - $wgMinFraudLicenseKey, - $wgMinFraudTimeout, - $wgDonationInterfaceMinFraudServers, - $wgDonationInterfaceEnableMinfraud, - $wgDonationInterfaceEnableFunctionsFilter, - $wgDonationInterfaceEnableReferrerFilter, - $wgDonationInterfaceEnableSourceFilter; - -$wgDonationInterfaceGatewayAdapters = array( - 'globalcollect'=> 'TestingGlobalCollectAdapter', - 'amazon'=> 'TestingAmazonAdapter', - 'adyen'=> 'TestingAdyenAdapter', - 'astropay'=> 'TestingAstroPayAdapter', - 'paypal_ec'=> 'PaypalExpressAdapter', // ooh, flexible! - 'paypal'=> 'TestingPaypalLegacyAdapter' -); -/** - * 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' => 'phpunittest...@wikimedia.org', -); -$wgPaypalGatewayReturnURL = 'http://donate.wikimedia.org'; // whatever, doesn't matter. - - -/** Amazon **/ -$wgAmazonGatewayReturnURL = 'https://payments.wikimedia.org/index.php/Special:AmazonGateway'; -$wgAmazonGatewayAccountInfo = array(); -$wgAmazonGatewayAccountInfo['test'] = array( - 'SellerID' => 'ABCDEFGHIJKL', - 'ClientID' => 'amzn1.application-oa2-client.1a2b3c4d5e', - 'ClientSecret' => '12432g134e3421a41234b1341c324123d', - 'MWSAccessKey' => 'N0NSENSEXYZ', - 'MWSSecretKey' => 'iuasd/2jhaslk2j49lkaALksdJLsJLas+', - 'Region' => 'us', - 'WidgetScriptURL' => - 'https://static-na.payments-amazon.com/OffAmazonPayments/us/sandbox/js/Widgets.js', - 'ReturnURL' => "https://example.org/index.php/Special:AmazonGateway?debug=true", -); - -/** Adyen **/ -$wgAdyenGatewayURL = 'https://testorwhatever.adyen.com'; -$wgAdyenGatewayAccountInfo = array(); -$wgAdyenGatewayAccountInfo['test'] = array( - 'AccountName' => 'wikitest', - 'SharedSecret' => 'C7F1D9E29479CF18131063A742CD2703FB9D48BAB0160693045E3FB7B8508E59', - 'SkinCode' => 'testskin', -); - -/** AstroPay **/ -$wgAstroPayGatewayURL = 'https://astropay.example.com/'; -$wgAstroPayGatewayTestingURL = 'https://sandbox.astropay.example.com/'; -$wgAstroPayGatewayAccountInfo = array(); -$wgAstroPayGatewayAccountInfo['test'] = array( - 'Create' => array( - 'Login' => 'createlogin', - 'Password' => 'createpass', - ), - 'Status' => array( - 'Login' => 'statuslogin', - 'Password' => 'statuspass', - ), - 'SecretKey' => 'NanananananananananananananananaBatman', -); -$wgAstroPayGatewayFallbackCurrency = false; - -$wgMinFraudLicenseKey = 'testkey'; -$wgMinFraudTimeout = 1; -$wgDonationInterfaceMinFraudServers = array( "minfraud.wikimedia.org" ); - -// Don't connect to the queue. -$wgDonationInterfaceEnableQueue = false; - -// 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 (4a92bf Configurable queue mirroring) diff --git a/tests/includes/TestingGatewayPage.php b/tests/includes/TestingGatewayPage.php deleted file mode 100644 index 6587dba..0000000 --- a/tests/includes/TestingGatewayPage.php +++ /dev/null @@ -1,18 +0,0 @@ -<<<<<<< HEAD (226ee4 Make RapidFail rapid, avoid redirect loop) -======= -<?php - -class TestingGatewayPage extends GatewayPage { - - protected $gatewayName = 'globalcollect'; - - public function __construct() { - $this->logger = DonationLoggerFactory::getLoggerForType( 'TestingGenericAdapter' ); - //nothing! - } - - protected function handleRequest() { - //also nothing! - } -} ->>>>>>> BRANCH (4a92bf Configurable queue mirroring) diff --git a/vendor b/vendor index 06bfa03..cf2b6c5 160000 --- a/vendor +++ b/vendor @@ -1 +1 @@ -Subproject commit 06bfa039acf9ca59207775f7d26028404bc96395 +Subproject commit cf2b6c5a5e9ce2b7e989d7802d2711aa8ead3638 -- To view, visit https://gerrit.wikimedia.org/r/301634 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8ef0613456d9dfdb4b4b1ac28c4cc88f4c003859 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/DonationInterface Gerrit-Branch: deployment Gerrit-Owner: Ejegg <eeggles...@wikimedia.org> Gerrit-Reviewer: Ejegg <eeggles...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits