Awight has uploaded a new change for review.

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

Change subject: Hair-raising hack to pass dummy gateway response code to 
DonationInterface
......................................................................

Hair-raising hack to pass dummy gateway response code to DonationInterface

Change-Id: Ia7acb8bd61505bc6f43335460cc8404d74922ab5
---
M sites/all/modules/recurring_globalcollect/tests/RecurringGlobalCollectTest.php
A 
sites/all/modules/recurring_globalcollect/tests/TestingRecurringStubAdapter.php
2 files changed, 27 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/94/310694/1

diff --git 
a/sites/all/modules/recurring_globalcollect/tests/RecurringGlobalCollectTest.php
 
b/sites/all/modules/recurring_globalcollect/tests/RecurringGlobalCollectTest.php
index 68f0278..7bfada8 100644
--- 
a/sites/all/modules/recurring_globalcollect/tests/RecurringGlobalCollectTest.php
+++ 
b/sites/all/modules/recurring_globalcollect/tests/RecurringGlobalCollectTest.php
@@ -65,6 +65,15 @@
 
        function testChargeRecorded() {
 
+               // Get some extra access to the testing adapter :(
+               global $wgDonationInterfaceGatewayAdapters;
+               $wgDonationInterfaceGatewayAdapters['globalcollect'] = 
'TestingRecurringStubAdapter';
+
+               // Include using require_once rather than autoload because the 
file
+               // depends on a DonationInterface testing class we loaded above.
+               require_once __DIR__ . '/TestingRecurringStubAdapter.php';
+               TestingRecurringStubAdapter::$singletonDummyGatewayResponseCode 
= 'recurring-OK';
+
                recurring_globalcollect_charge( $this->contributionRecurId );
 
                $result = civicrm_api3( 'Contribution', 'get', array(
diff --git 
a/sites/all/modules/recurring_globalcollect/tests/TestingRecurringStubAdapter.php
 
b/sites/all/modules/recurring_globalcollect/tests/TestingRecurringStubAdapter.php
new file mode 100644
index 0000000..62c5b8c
--- /dev/null
+++ 
b/sites/all/modules/recurring_globalcollect/tests/TestingRecurringStubAdapter.php
@@ -0,0 +1,18 @@
+<?php
+
+/**
+ * NASTY but manually loaded to get around autoload nonsense.
+ *
+ * Injects statically set vars into instance testing fields.
+ */
+class TestingRecurringStubAdapter extends TestingGlobalCollectAdapter {
+       public static $singletonDummyGatewayResponseCode;
+
+       public function __construct( $options = array() ) {
+               parent::__construct( $options );
+               
+               if ( self::$singletonDummyGatewayResponseCode ) {
+                       $this->setDummyGatewayResponseCode( 
self::$singletonDummyGatewayResponseCode );
+               }
+       }
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia7acb8bd61505bc6f43335460cc8404d74922ab5
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Awight <awi...@wikimedia.org>

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

Reply via email to