jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/362307 )
Change subject: Fix function visibility in default getRequestProcessId ...................................................................... Fix function visibility in default getRequestProcessId Ugh. Sloppy error. I'd written unit tests, but they only covered the Paypal Express resultswitcher, whose gateway was overriding the function with public visibility. This commit adds a test for the GlobalCollect resultswitcher. TODO: AstroPay and Adyen resultswitcher tests. Change-Id: Ia1cd67b1823b5ad11a230758f8eb5f2ea7f24142 --- M gateway_common/gateway.adapter.php A tests/phpunit/Adapter/GlobalCollect/ResultSwitcherTest.php 2 files changed, 57 insertions(+), 1 deletion(-) Approvals: Mepps: Looks good to me, approved jenkins-bot: Verified diff --git a/gateway_common/gateway.adapter.php b/gateway_common/gateway.adapter.php index 2752870..e34988d 100644 --- a/gateway_common/gateway.adapter.php +++ b/gateway_common/gateway.adapter.php @@ -1460,7 +1460,7 @@ * @param array $requestValues * @return int|string Order id */ - protected function getRequestProcessId( $requestValues ) { + public function getRequestProcessId( $requestValues ) { return null; } diff --git a/tests/phpunit/Adapter/GlobalCollect/ResultSwitcherTest.php b/tests/phpunit/Adapter/GlobalCollect/ResultSwitcherTest.php new file mode 100644 index 0000000..f56357f --- /dev/null +++ b/tests/phpunit/Adapter/GlobalCollect/ResultSwitcherTest.php @@ -0,0 +1,56 @@ +<?php +/** + * @group Fundraising + * @group DonationInterface + * @group GlobalCollect + */ +class DonationInterface_Adapter_GlobalCollect_ResultSwitcherTest extends DonationInterfaceTestCase { + protected $testAdapterClass = 'TestingGlobalCollectAdapter'; + + public function setUp() { + parent::setUp(); + + $this->setMwGlobals( + array( + 'wgGlobalCollectGatewayEnabled' => true, + ) + ); + } + + /** + * Assuming we've popped out of the frame, does processing succeed? + */ + public function testResultSwitcherLiberatedSuccess() { + $donorTestData = $this->getDonorTestData( 'FR' ); + $donorTestData['payment_method'] = 'cc'; + $donorTestData['payment_submethod'] = 'visa'; + $donorTestData['email'] = 'innoc...@localhost.net'; + $donorTestData['order_id'] = mt_rand(); + $session['Donor'] = $donorTestData; + // Mark the order as already popped out of the iframe + $session['order_status'][$donorTestData['order_id']] = 'liberated'; + $request = array( + 'REF' => $donorTestData['order_id'], + 'CVVRESULT' => 'M', + 'AVSRESULT' => '0', + 'language' => 'fr', // FIXME: verifyFormOutput conflates request with other stuff + ); + $assertNodes = array( + 'headers' => array( + 'Location' => function( $location ) use ( $donorTestData ) { + // Do this after the real processing to avoid side effects + $gateway = $this->getFreshGatewayObject( $donorTestData ); + $url = ResultPages::getThankYouPage( $gateway ); + $this->assertEquals( $url, $location ); + } + ) + ); + + $this->verifyFormOutput( 'GlobalCollectGatewayResult', $request, $assertNodes, false, $session ); + // Make sure we logged the expected cURL attempts + $messages = $this->getLogMatches( 'info', '/Preparing to send GET_ORDERSTATUS transaction to Global Collect/' ); + $this->assertNotEmpty( $messages ); + $messages = $this->getLogMatches( 'info', '/Preparing to send SET_PAYMENT transaction to Global Collect/' ); + $this->assertNotEmpty( $messages ); + } +} -- To view, visit https://gerrit.wikimedia.org/r/362307 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia1cd67b1823b5ad11a230758f8eb5f2ea7f24142 Gerrit-PatchSet: 5 Gerrit-Project: mediawiki/extensions/DonationInterface Gerrit-Branch: master Gerrit-Owner: Ejegg <ej...@ejegg.com> Gerrit-Reviewer: Mepps <me...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits