Ejegg has submitted this change and it was merged. Change subject: Merge master into deployment ......................................................................
Merge master into deployment 5f449a8 Localisation updates from https://translatewiki.net. f29c669 move worldpay payment methods 2a61782 Remove deprecated parameters 5500300 gateway_adapter&loadConfig() 2a591d3 Shorter selector for .hidden a9e56e6 Move currencies to config c571dce Compress PNGs using zopflipng 0060512 Astropay: remove Banco de Chile from CL/BT 62a0f7d Astropay: WebPay as main processor for credit cards CL d97ad0a Encapsulate Worldpay staging logic d32731a Move Worldpay currencies to config 7f05102 Random cleanups 93eaf6b Move var_map to config 96b7e7e Move data constraints to config d8edb4b Add another method to GatewayType interface bedb0d9 Change MX dummy fiscal number to 13 digits Removed tests Change-Id: I460da06b3c7ec73aa48459808eda4dba181cda3e --- D tests/includes/test_gateway/TestingGenericAdapter.php D tests/includes/test_gateway/TestingGlobalCollectAdapter.php D tests/includes/test_gateway/TestingGlobalCollectOrphanAdapter.php 3 files changed, 0 insertions(+), 387 deletions(-) Approvals: Ejegg: Verified; Looks good to me, approved diff --git a/tests/includes/test_gateway/TestingGenericAdapter.php b/tests/includes/test_gateway/TestingGenericAdapter.php deleted file mode 100644 index ede6afb..0000000 --- a/tests/includes/test_gateway/TestingGenericAdapter.php +++ /dev/null @@ -1,119 +0,0 @@ -<<<<<<< HEAD (8d324c Tiny cleanups) -======= -<?php -/** - * Wikimedia Foundation - * - * LICENSE - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -/** - * A really dumb adapter. - */ -class TestingGenericAdapter extends GatewayAdapter { - - /** - * A list of fake errors that is returned each time revalidate() is called. - */ - public $errorsForRevalidate = array(); - - public $revalidateCount = 0; - public static $fakeGlobals = array(); - - public static $fakeIdentifier; - - public static $acceptedCurrencies = array(); - - public function getCommunicationType() { - return 'xml'; - } - - public function revalidate($check_not_empty = array()) { - if ( !empty( $this->errorsForRevalidate ) ) { - $fakeErrors = $this->errorsForRevalidate[$this->revalidateCount]; - if ( $fakeErrors !== null ) { - $this->revalidateCount++; - $this->setValidationErrors( $fakeErrors ); - return empty( $fakeErrors ); - } - } - return parent::revalidate($check_not_empty); - } - - public function normalizeOrderID( $override = null, $dataObj = null ) { - return '12345'; - } - - public static function getGlobal( $name ) { - if ( array_key_exists( $name, TestingGenericAdapter::$fakeGlobals ) ) { - return TestingGenericAdapter::$fakeGlobals[$name]; - } - return parent::getGlobal( $name ); - } - - public static function getIdentifier() { - if ( self::$fakeIdentifier ) { - return self::$fakeIdentifier; - } - return GatewayAdapter::getIdentifier(); - } - - public function loadConfig() { - } - - public function defineAccountInfo() { - } - - public function defineDataConstraints() { - } - - public function defineErrorMap() { - } - - public function defineOrderIDMeta() { - } - - public function definePaymentMethods() { - } - - public function defineReturnValueMap() { - } - - public function defineStagedVars() { - } - - public function defineTransactions() { - } - - public function defineDataTransformers() { - $this->data_transformers = parent::getCoreDataTransformers(); - } - - public function defineVarMap() { - } - - public function processResponse( $response ) { - } - - public function setGatewayDefaults() { - } - - public function getCurrencies( $options = array() ) { - return TestingGenericAdapter::$acceptedCurrencies; - } - - public function doPayment() { - } -} ->>>>>>> BRANCH (bedb0d Change MX dummy fiscal number to 13 digits) diff --git a/tests/includes/test_gateway/TestingGlobalCollectAdapter.php b/tests/includes/test_gateway/TestingGlobalCollectAdapter.php deleted file mode 100644 index 5bff423..0000000 --- a/tests/includes/test_gateway/TestingGlobalCollectAdapter.php +++ /dev/null @@ -1,147 +0,0 @@ -<<<<<<< HEAD (8d324c Tiny cleanups) -======= -<?php - -/** - * TestingGlobalCollectAdapter - * - * TODO: Add dependency injection to the base class so we don't have to repeat code here. - */ -class TestingGlobalCollectAdapter extends GlobalCollectAdapter { - - public $curled = array ( ); - - public $limbo_messages = array(); - - public $dummyGatewayResponseCode; - - /** - * Also set a useful MerchantID. - */ - public function __construct( $options = array ( ) ) { - if ( is_null( $options ) ) { - $options = array ( ); - } - - //I hate myself for this part, and so do you. - //Deliberately not fixing the actual problem for this patchset. - //@TODO: Change the way the constructor works in all adapter - //objects, such that the mess I am about to make is no longer - //necessary. A patchset may already be near-ready for this... - if ( array_key_exists( 'order_id_meta', $options ) ) { - $this->order_id_meta = $options['order_id_meta']; - unset( $options['order_id_meta'] ); - } - - $this->options = $options; - - parent::__construct( $this->options ); - } - - /** - * @TODO: Get rid of this and the override mechanism as soon as you - * refactor the constructor into something reasonable. - */ - public function defineOrderIDMeta() { - if ( isset( $this->order_id_meta ) ) { - return; - } - parent::defineOrderIDMeta(); - } - - // TODO: Store and test the actual messages. - public function setLimboMessage( $queue = 'limbo' ) { - $this->limbo_messages[] = false; - } - - /** - * Stub out the limboStomp fn and record the calls - */ - public function deleteLimboMessage( $queue = 'limbo' ) { - $this->limbo_messages[] = true; - } - - //@TODO: That minfraud jerk needs its own isolated tests. - function runAntifraudHooks() { - //now screw around with the batch settings to trick the fraud filters into triggering - $is_batch = $this->isBatchProcessor(); - $this->batch = true; - - parent::runAntifraudHooks(); - - $this->batch = $is_batch; - } - - /** - * Set the error code you want the dummy response to return - */ - public function setDummyGatewayResponseCode( $code ) { - $this->dummyGatewayResponseCode = $code; - } - - /** - * Set the error code you want the dummy response to return - */ - public function setDummyCurlResponseCode( $code ) { - $this->dummyCurlResponseCode = $code; - } - - protected function curl_transaction( $data ) { - $this->curled[] = $data; - return parent::curl_transaction( $data ); - } - - /** - * Load in some dummy response XML so we can test proper response processing - * @throws RuntimeException - */ - protected function curl_exec( $ch ) { - $code = ''; - if ( $this->dummyGatewayResponseCode ) { - if ( is_array( $this->dummyGatewayResponseCode ) ) { - $code = array_shift( $this->dummyGatewayResponseCode ); - } elseif ( is_callable( $this->dummyGatewayResponseCode ) ) { - $code = call_user_func( $this->dummyGatewayResponseCode, $this ); - } else { - $code = $this->dummyGatewayResponseCode; - } - } - if ( $code ) { - if ( $code === 'Exception' ) { - throw new RuntimeException('blah!'); - } - $code = '_' . $code; - } - - //could start stashing these in a further-down subdir if payment type starts getting in the way, - //but frankly I don't want to write tests that test our dummy responses. - $file_path = __DIR__ . '/../'; - $file_path .= 'Responses' . '/' . self::getIdentifier() . '/'; - $file_path .= $this->getCurrentTransaction() . $code . '.testresponse'; - - //these are all going to be short, so... - if ( file_exists( $file_path ) ) { - return file_get_contents( $file_path ); - } else { - echo "File $file_path does not exist.\n"; //<-That will deliberately break the test. - return false; - } - } - - /** - * Load in some dummy curl response info so we can test proper response processing - */ - protected function curl_getinfo( $ch, $opt = null ) { - $code = 200; //response OK - if ( property_exists( $this, 'dummyCurlResponseCode' ) ) { - $code = ( int ) $this->dummyCurlResponseCode; - } - - //put more here if it ever turns out that we care about it. - return array ( - 'http_code' => $code, - ); - } - -} ->>>>>>> BRANCH (bedb0d Change MX dummy fiscal number to 13 digits) diff --git a/tests/includes/test_gateway/TestingGlobalCollectOrphanAdapter.php b/tests/includes/test_gateway/TestingGlobalCollectOrphanAdapter.php deleted file mode 100644 index b2b7efb..0000000 --- a/tests/includes/test_gateway/TestingGlobalCollectOrphanAdapter.php +++ /dev/null @@ -1,121 +0,0 @@ -<<<<<<< HEAD (8d324c Tiny cleanups) -======= -<?php - -/** - * TestingGlobalCollectOrphanAdapter - * - * This is officially truly silly now. - * TODO: Poke own eye out before you notice that multiple inheritance would, if - * available, cause this file to deflate by 4/5ths. - */ - -class TestingGlobalCollectOrphanAdapter extends GlobalCollectOrphanAdapter { - - public $curled = array ( ); - - /** - * Also set a useful MerchantID. - */ - public function __construct( $options = array ( ) ) { - if ( is_null( $options ) ) { - $options = array ( ); - } - - //I hate myself for this part, and so do you. - //Deliberately not fixing the actual problem for this patchset. - //@TODO: Change the way the constructor works in all adapter - //objects, such that the mess I am about to make is no longer - //necessary. A patchset may already be near-ready for this... - if ( array_key_exists( 'order_id_meta', $options ) ) { - $this->order_id_meta = $options['order_id_meta']; - unset( $options['order_id_meta'] ); - } - - $this->options = $options; - - parent::__construct( $this->options ); - } - - /** - * @TODO: Get rid of this and the override mechanism as soon as you - * refactor the constructor into something reasonable. - */ - public function defineOrderIDMeta() { - if ( isset( $this->order_id_meta ) ) { - return; - } - parent::defineOrderIDMeta(); - } - - //@TODO: That minfraud jerk needs its own isolated tests. - function runAntifraudHooks() { - //now screw around with the batch settings to trick the fraud filters into triggering - $is_batch = $this->isBatchProcessor(); - $this->batch = true; - - parent::runAntifraudHooks(); - - $this->batch = $is_batch; - } - - /** - * Set the error code you want the dummy response to return - */ - public function setDummyGatewayResponseCode( $code ) { - $this->dummyGatewayResponseCode = $code; - } - - /** - * Set the error code you want the dummy response to return - */ - public function setDummyCurlResponseCode( $code ) { - $this->dummyCurlResponseCode = $code; - } - - protected function curl_transaction( $data ) { - $this->curled[] = $data; - return parent::curl_transaction( $data ); - } - - /** - * Load in some dummy response XML so we can test proper response processing - */ - protected function curl_exec( $ch ) { - $code = ''; - if ( property_exists( $this, 'dummyGatewayResponseCode' ) ) { - $code = '_' . $this->dummyGatewayResponseCode; - } - - //could start stashing these in a further-down subdir if payment type starts getting in the way, - //but frankly I don't want to write tests that test our dummy responses. - $file_path = __DIR__ . '/../'; - $file_path .= 'Responses' . '/' . self::getIdentifier() . '/'; - $file_path .= $this->getCurrentTransaction() . $code . '.testresponse'; - - //these are all going to be short, so... - if ( file_exists( $file_path ) ) { - return file_get_contents( $file_path ); - } else { - echo "File $file_path does not exist.\n"; //<-That will deliberately break the test. - return false; - } - } - - /** - * Load in some dummy curl response info so we can test proper response processing - */ - protected function curl_getinfo( $ch, $opt = null ) { - $code = 200; //response OK - if ( property_exists( $this, 'dummyCurlResponseCode' ) ) { - $code = ( int ) $this->dummyCurlResponseCode; - } - - //put more here if it ever turns out that we care about it. - return array ( - 'http_code' => $code, - ); - } - -} ->>>>>>> BRANCH (bedb0d Change MX dummy fiscal number to 13 digits) -- To view, visit https://gerrit.wikimedia.org/r/281487 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I460da06b3c7ec73aa48459808eda4dba181cda3e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/DonationInterface Gerrit-Branch: deployment Gerrit-Owner: Ejegg <[email protected]> Gerrit-Reviewer: Ejegg <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
