Ejegg has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/375413 )

Change subject: Update RecurringGlobalCollectTest for static traits
......................................................................

Update RecurringGlobalCollectTest for static traits

Don't need TestingRecurringStubAdapter any more.

Change-Id: Ifc2a647a21689bf4814d847e35748de64ac4baac
---
M sites/all/modules/recurring_globalcollect/tests/RecurringGlobalCollectTest.php
D 
sites/all/modules/recurring_globalcollect/tests/TestingRecurringStubAdapter.php
2 files changed, 10 insertions(+), 35 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/13/375413/1

diff --git 
a/sites/all/modules/recurring_globalcollect/tests/RecurringGlobalCollectTest.php
 
b/sites/all/modules/recurring_globalcollect/tests/RecurringGlobalCollectTest.php
index fc2fc0c..c3d2d06 100644
--- 
a/sites/all/modules/recurring_globalcollect/tests/RecurringGlobalCollectTest.php
+++ 
b/sites/all/modules/recurring_globalcollect/tests/RecurringGlobalCollectTest.php
@@ -14,8 +14,6 @@
                parent::setUp();
                civicrm_initialize();
 
-               // FIXME - but do we really want to stuff the autoloader with 
all of our test classes?
-               require_once( DRUPAL_ROOT . 
'/../vendor/wikimedia/donation-interface/tests/phpunit/includes/test_gateway/TestingGlobalCollectAdapter.php'
 );
                global $wgDonationInterfaceGatewayAdapters,
                        $wgDonationInterfaceForbiddenCountries,
                        $wgDonationInterfacePriceFloor,
@@ -66,20 +64,17 @@
                        'ts' => wmf_common_date_unix_to_sql( strtotime( 'now' ) 
),
                        'contribution_id' => $result['id'],
                );
+               TestingGlobalCollectAdapter::setDummyGatewayResponseCode( 
'recurring-OK' );
                wmf_civicrm_insert_contribution_tracking( $tracking );
        }
 
+       public function tearDown() {
+               parent::tearDown();
+               $this->cleanUpContact( $this->contactId );
+               TestingGlobalCollectAdapter::setDummyGatewayResponseCode( null 
);
+       }
+
        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(
@@ -108,8 +103,6 @@
                );
                $gateway = DonationInterfaceFactory::createAdapter( 
'globalcollect', $init );
 
-               $gateway->setDummyGatewayResponseCode( 'recurring-OK' );
-
                $result = $gateway->do_transaction( 'Recurring_Charge' );
 
                $this->assertTrue( $result->getCommunicationStatus() );
@@ -132,7 +125,7 @@
                );
                $gateway = DonationInterfaceFactory::createAdapter( 
'globalcollect', $init );
 
-               $gateway->setDummyGatewayResponseCode( 'recurring-declined' );
+               TestingGlobalCollectAdapter::setDummyGatewayResponseCode( 
'recurring-declined' );
 
                $result = $gateway->do_transaction( 'Recurring_Charge' );
 
@@ -159,7 +152,7 @@
                );
                $gateway = DonationInterfaceFactory::createAdapter( 
'globalcollect', $init );
 
-               $gateway->setDummyGatewayResponseCode( 'recurring-timeout' );
+               TestingGlobalCollectAdapter::setDummyGatewayResponseCode( 
'recurring-timeout' );
 
                $result = $gateway->do_transaction( 'Recurring_Charge' );
 
@@ -185,7 +178,7 @@
                );
                $gateway = DonationInterfaceFactory::createAdapter( 
'globalcollect', $init );
 
-               $gateway->setDummyGatewayResponseCode( 'recurring-resume' );
+               TestingGlobalCollectAdapter::setDummyGatewayResponseCode( 
'recurring-resume' );
 
                $result = $gateway->do_transaction( 'Recurring_Charge' );
 
diff --git 
a/sites/all/modules/recurring_globalcollect/tests/TestingRecurringStubAdapter.php
 
b/sites/all/modules/recurring_globalcollect/tests/TestingRecurringStubAdapter.php
deleted file mode 100644
index 62c5b8c..0000000
--- 
a/sites/all/modules/recurring_globalcollect/tests/TestingRecurringStubAdapter.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?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/375413
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifc2a647a21689bf4814d847e35748de64ac4baac
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to