Ejegg has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/340773 )
Change subject: Merge branch 'master' into deployment ...................................................................... Merge branch 'master' into deployment Also delete tests and update libs ebf4488 Look up iDEAL banks, provide PSR6 to SmashPig e0f6612 Fixes for iDEAL/PSR-6 caching 68c72fa Update SmashPig library e41d3bd Another SmashPig initialization fix 43555e7 Set SmashPig logging prefix 75b2bd8 Localisation updates from https://translatewiki.net. c71f07b Remove deprecated langonly file for loading i18n messages on donatewiki Change-Id: I0d374c0c760f3b00f74e5728d94fc9ea841ac613 --- D tests/phpunit/Adapter/GlobalCollect/RealTimeBankTransferIdealTest.php D tests/phpunit/IPVelocityTest.php M vendor 3 files changed, 1 insertion(+), 461 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface refs/changes/73/340773/1 diff --git a/tests/phpunit/Adapter/GlobalCollect/RealTimeBankTransferIdealTest.php b/tests/phpunit/Adapter/GlobalCollect/RealTimeBankTransferIdealTest.php deleted file mode 100644 index 60bb9e2..0000000 --- a/tests/phpunit/Adapter/GlobalCollect/RealTimeBankTransferIdealTest.php +++ /dev/null @@ -1,370 +0,0 @@ -<<<<<<< HEAD (c75e32 process payment before popping out of iframe) -======= -<?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 SmashPig\Core\Configuration; -use SmashPig\Core\Context; - -/** - * - * @group Fundraising - * @group DonationInterface - * @group GlobalCollect - * @group RealTimeBankTransfer - */ -class DonationInterface_Adapter_GlobalCollect_RealTimeBankTransferIdealTest extends DonationInterfaceTestCase { - /** - * @var PHPUnit_Framework_MockObject_MockObject - */ - protected $bankPaymentProvider; - - public function setUp() { - parent::setUp(); - - $config = Configuration::createForView( 'ingenico' ); - Context::initWithLogger( $config ); // gets torn down in parent - - $this->bankPaymentProvider = $this->getMockBuilder( - '\SmashPig\PaymentProviders\Ingenico\BankPaymentProvider' - )->disableOriginalConstructor()->getMock(); - - $config->overrideObjectInstance( 'payment-provider/rtbt', $this->bankPaymentProvider ); - - $this->bankPaymentProvider->method( 'getBankList' ) - ->willReturn( array( - 'Test1234' => 'Test Bank 1234', - 'Test5678' => 'Test Bank 5678', - ) ); - - - $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 ( - 'amount' => array ( - 'nodename' => 'input', - 'value' => '1.55', - ), - 'currency_code' => array ( - 'nodename' => 'select', - 'selected' => 'EUR', - ), - 'country' => array ( - 'nodename' => 'input', - 'value' => 'NL', - ), - 'issuer_id' => array ( - 'innerhtmlmatches' => '/Test Bank 1234/' - ) - ); - - $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 (c71f07 Remove deprecated langonly file for loading i18n messages on) diff --git a/tests/phpunit/IPVelocityTest.php b/tests/phpunit/IPVelocityTest.php deleted file mode 100644 index fe2aca8..0000000 --- a/tests/phpunit/IPVelocityTest.php +++ /dev/null @@ -1,90 +0,0 @@ -<?php - -/** - * @group FraudFilters - */ -class IPVelocityTest extends DonationInterfaceTestCase { - - /** - * @var BagOStuff - */ - protected $cache; - /** - * @var Gateway_Extras_CustomFilters - */ - protected $cfo; - /** - * @var Gateway_Extras_CustomFilters_IP_Velocity - */ - protected $ipFilter; - protected $oldCache; - - public function setUp() { - parent::setUp(); - - global $wgDonationInterfaceIPVelocityToxicDuration, - $wgDonationInterfaceIPVelocityFailDuration, - $wgDonationInterfaceIPWhitelist, - $wgDonationInterfaceIPBlacklist; - - $wgDonationInterfaceIPVelocityToxicDuration = 1000; - $wgDonationInterfaceIPVelocityFailDuration = 500; - - $wgDonationInterfaceIPWhitelist = array( '1.2.3.4' ); - $wgDonationInterfaceIPBlacklist = array( '5.6.7.8' ); - $this->setMwGlobals( array( - 'wgMainCacheType' => CACHE_DB, - 'wgDonationInterfaceEnableIPVelocityFilter' => true, - 'wgDonationInterfaceIPVelocityFailDuration' => 150, - 'wgDonationInterfaceIPVelocityTimeout' => 200, - 'wgDonationInterfaceIPVelocityFailScore' => 100, - 'wgDonationInterfaceIPVelocityThreshhold' => 3, - ) ); - $this->oldCache = ObjectCache::$instances[CACHE_DB]; - $this->cache = new HashBagOStuff(); - ObjectCache::$instances[CACHE_DB] = $this->cache; - $this->gatewayAdapter = new TestingGenericAdapter( array( - 'batch_mode' => false - ) ); - $this->cfo = Gateway_Extras_CustomFilters::singleton( - $this->gatewayAdapter - ); - } - - public function tearDown() { - parent::tearDown(); - - global $wgDonationInterfaceIPVelocityToxicDuration, - $wgDonationInterfaceIPVelocityFailDuration, - $wgDonationInterfaceIPWhitelist, - $wgDonationInterfaceIPBlacklist; - - unset( $wgDonationInterfaceIPVelocityToxicDuration ); - unset( $wgDonationInterfaceIPVelocityFailDuration ); - unset( $wgDonationInterfaceIPWhitelist ); - unset( $wgDonationInterfaceIPBlacklist ); - ObjectCache::$instances[CACHE_DB] = $this->oldCache; - } - - public function testStoresTimestampOnPostProcess() { - Gateway_Extras_CustomFilters_IP_Velocity::onPostProcess( - $this->gatewayAdapter - ); - $cached = $this->cache->get( '127.0.0.1' ); - $this->assertEquals( 1, count( $cached ) ); - // Time should be close to now - $diff = time() - $cached[0]; - $this->assertTrue( $diff < 2 ); - } - - public function testInitialFilter() { - Gateway_Extras_CustomFilters_IP_Velocity::onPostProcess( - $this->gatewayAdapter - ); - $cached = $this->cache->get( '127.0.0.1' ); - $this->assertEquals( 1, count( $cached ) ); - // Time should be close to now - $diff = time() - $cached[0]; - $this->assertTrue( $diff < 2 ); - } -} diff --git a/vendor b/vendor index 361bfc7..9744ca0 160000 --- a/vendor +++ b/vendor @@ -1 +1 @@ -Subproject commit 361bfc74bd56c38d6c3a58fb198511b38d6d5380 +Subproject commit 9744ca0309906899fbaa1e3582ca14243e19d7ba -- To view, visit https://gerrit.wikimedia.org/r/340773 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0d374c0c760f3b00f74e5728d94fc9ea841ac613 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/DonationInterface Gerrit-Branch: deployment Gerrit-Owner: Ejegg <eeggles...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits