Ejegg has uploaded a new change for review.

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

Change subject: Merge commit 'ae5a926512fb07c3a74ed5163e43f83dd93bc917' into 
deployment
......................................................................

Merge commit 'ae5a926512fb07c3a74ed5163e43f83dd93bc917' into deployment

Gets the donations queue consumer back on top of all the recent
cherry-picks

Change-Id: Id792d619a41a6b787c784154e6f914bd6dfa628b
---
M civicrm
M composer.lock
M sites/all/modules/queue2civicrm/queue2civicrm.module
D sites/all/modules/queue2civicrm/tests/phpunit/AntifraudQueueTest.php
D sites/all/modules/queue2civicrm/tests/phpunit/BannerHistoryTest.php
D sites/all/modules/queue2civicrm/tests/phpunit/PaymentsInitQueueTest.php
D sites/all/modules/queue2civicrm/tests/phpunit/ProcessMessageTest.php
D sites/all/modules/wmf_audit/tests/AdyenAuditTest.php
D sites/all/modules/wmf_audit/tests/AmazonAuditTest.php
M sites/all/modules/wmf_civicrm/wmf_civicrm.module
D sites/all/modules/wmf_common/tests/includes/BaseWmfDrupalPhpUnitTestCase.php
11 files changed, 1 insertion(+), 1,325 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/35/313535/1

diff --git a/civicrm b/civicrm
index 51079f3..c291b67 160000
--- a/civicrm
+++ b/civicrm
@@ -1 +1 @@
-Subproject commit 51079f32513ec33da20c78709a147dd39b8aa2bb
+Subproject commit c291b67ed20677edc1be3f9a0a70c0b127600c82
diff --git a/composer.lock b/composer.lock
index bdc1faf..eafee07 100644
--- a/composer.lock
+++ b/composer.lock
@@ -1091,11 +1091,7 @@
             "source": {
                 "type": "git",
                 "url": 
"https://gerrit.wikimedia.org/r/mediawiki/extensions/DonationInterface.git";,
-<<<<<<< HEAD   (d9209c Revert "Revert "Mirror messages to new queues in GC 
audit"")
                 "reference": "ebb773d1d725cecf1d745e9d0ff345060120bc3c"
-=======
-                "reference": "9fa6e351ed42d7be7387b6fac8d2beb918cb9304"
->>>>>>> BRANCH (ae5a92 Move donation queue consumer off ActiveMQ)
             },
             "require": {
                 "amzn/login-and-pay-with-amazon-sdk-php": "dev-master",
@@ -1135,11 +1131,7 @@
                 "GPL-2.0"
             ],
             "description": "Wikimedia Foundation payment processing library",
-<<<<<<< HEAD   (d9209c Revert "Revert "Mirror messages to new queues in GC 
audit"")
             "time": "2016-09-15 19:32:11"
-=======
-            "time": "2016-09-13 18:41:14"
->>>>>>> BRANCH (ae5a92 Move donation queue consumer off ActiveMQ)
         },
         {
             "name": "wikimedia/smash-pig",
@@ -1147,11 +1139,7 @@
             "source": {
                 "type": "git",
                 "url": 
"https://gerrit.wikimedia.org/r/wikimedia/fundraising/SmashPig.git";,
-<<<<<<< HEAD   (d9209c Revert "Revert "Mirror messages to new queues in GC 
audit"")
                 "reference": "61f47be34b4c8ade307bf218b84c55966a8e4acb"
-=======
-                "reference": "8625a3502c2f7f48b6ed0e388d95b35a6398ad9f"
->>>>>>> BRANCH (ae5a92 Move donation queue consumer off ActiveMQ)
             },
             "require": {
                 "amzn/login-and-pay-with-amazon-sdk-php": "dev-master",
@@ -1202,11 +1190,7 @@
                 "donations",
                 "payments"
             ],
-<<<<<<< HEAD   (d9209c Revert "Revert "Mirror messages to new queues in GC 
audit"")
             "time": "2016-09-15 00:32:38"
-=======
-            "time": "2016-09-13 18:34:33"
->>>>>>> BRANCH (ae5a92 Move donation queue consumer off ActiveMQ)
         },
         {
             "name": "zordius/lightncandy",
diff --git a/sites/all/modules/queue2civicrm/queue2civicrm.module 
b/sites/all/modules/queue2civicrm/queue2civicrm.module
index b45adbd..e36778b 100644
--- a/sites/all/modules/queue2civicrm/queue2civicrm.module
+++ b/sites/all/modules/queue2civicrm/queue2civicrm.module
@@ -2,10 +2,6 @@
 use queue2civicrm\DonationQueueConsumer;
 use SmashPig\Core\Configuration;
 use SmashPig\Core\Context;
-<<<<<<< HEAD   (d9209c Revert "Revert "Mirror messages to new queues in GC 
audit"")
-use SmashPig\Core\DataStores\PendingDatabase;
-=======
->>>>>>> BRANCH (ae5a92 Move donation queue consumer off ActiveMQ)
 
 // include common functions
 require_once( drupal_get_path( 'module', 'queue2civicrm' ) . 
'/queue2civicrm_common.inc' );
@@ -227,114 +223,4 @@
   else {
     watchdog('queue2civicrm', 'No contributions processed.');
   }
-<<<<<<< HEAD   (d9209c Revert "Revert "Mirror messages to new queues in GC 
audit"")
-}
-
-/**
- * Process one contribution from the queue to CiviCRM.
- *
- * @param Stomp_Frame|array $msg
- */
-function queue2civicrm_import( $msg ) {
-    if ( is_object( $msg ) && property_exists( $msg, 'body' ) ) {
-        $msg = $msg->body;
-    }
-
-    if ( is_string( $msg ) ) {
-        // save the original message for logging
-        $msg_orig = $msg;
-
-        $msg = json_decode( $msg, true );
-    } else {
-        $msg_orig = json_encode( $msg );
-    }
-
-    /**
-    * prepare data for logging
-    */
-    $log = array(
-        'gateway' => $msg[ 'gateway' ],
-        'gateway_txn_id' => $msg[ 'gateway_txn_id' ],
-        'data' => $msg_orig,
-        'timestamp' => time(),
-        'verified' => 0,
-    );
-    $cid = _queue2civicrm_log( $log );
-
-    $dbEntry = false;
-    // If more information is available, find it from the pending database
-    // FIXME: replace completion_message_id with a boolean flag
-    if ( isset( $msg['completion_message_id'] ) ) {
-        $dbEntry = queue2civicrm_update_from_pending_db( $msg );
-        if ( !$dbEntry ) {
-            // If the contribution has already been imported, this check will
-            // throw an exception that says to drop it entirely, not re-queue.
-            wmf_civicrm_check_for_duplicates(
-                $msg['gateway'], $msg['gateway_txn_id']
-            );
-
-            // Otherwise, throw an exception that tells the queue consumer to
-            // requeue the incomplete message with a delay.
-            $errorMessage = "Message 
{$msg['gateway']}-{$msg['gateway_txn_id']} " .
-                "indicates a pending DB entry with order ID 
{$msg['order_id']}, " .
-                "but none was found.  Requeueing.";
-            throw new WmfException( 'MISSING_PREDECESSOR', $errorMessage );
-        }
-    }
-
-    $contribution = wmf_civicrm_contribution_message_import($msg);
-
-    // construct an array of useful info to invocations of queue2civicrm_import
-    $contribution_info = array(
-        'contribution_id' => $contribution['id'],
-        'contact_id' => $contribution['contact_id'],
-        'msg' => $msg,
-    );
-
-    // update the log if things went well
-    if ( $cid ) {
-        $log[ 'cid' ] = $cid;
-        $log[ 'verified' ] = 1;
-        $log[ 'timestamp' ] = time();
-        _queue2civicrm_log( $log );
-    }
-
-    // Send thank you email, other post-import things
-    module_invoke_all( 'queue2civicrm_import', $contribution_info );
-    
-    // keep count of the transactions
-    Queue2civicrmTrxnCounter::instance()->increment( $msg['gateway'] );
-
-    // Delete message from pending db once the rest has completed successfully
-    if ( $dbEntry ) {
-        PendingDatabase::get()->deleteMessage( $dbEntry );
-    }
-}
-
-/**
- * Fill in some missing information from the pending database
- * @param array $msg sparse donation message, usually from IPN listener
- * @return array|null message from database, or null if not found
- */
-function queue2civicrm_update_from_pending_db( &$msg ) {
-    $gateway = $msg['gateway'];
-    $orderId = $msg['order_id'];
-
-    $data = PendingDatabase::get()->fetchMessageByGatewayOrderId(
-        $gateway,
-        $orderId
-    );
-
-       // Sparse messages should have no keys at all for the missing info,
-       // rather than blanks or junk data. And $msg should always have newer
-       // info than the pending db.
-    if ( $data ) {
-        $msg = $msg + $data;
-        // $data has a pending_id key for ease of deletion,
-        // but $msg doesn't need it
-        unset( $msg['pending_id'] );
-    }
-    return $data;
-=======
->>>>>>> BRANCH (ae5a92 Move donation queue consumer off ActiveMQ)
 }
diff --git 
a/sites/all/modules/queue2civicrm/tests/phpunit/AntifraudQueueTest.php 
b/sites/all/modules/queue2civicrm/tests/phpunit/AntifraudQueueTest.php
deleted file mode 100644
index b3ddb18..0000000
--- a/sites/all/modules/queue2civicrm/tests/phpunit/AntifraudQueueTest.php
+++ /dev/null
@@ -1,136 +0,0 @@
-<<<<<<< HEAD   (d9209c Revert "Revert "Mirror messages to new queues in GC 
audit"")
-=======
-<?php
-use queue2civicrm\fredge\AntifraudQueueConsumer;
-use SmashPig\Core\Context;
-use SmashPig\Core\QueueConsumers\BaseQueueConsumer;
-use SmashPig\Tests\QueueTestConfiguration;
-
-/**
- * @group Queue2Civicrm
- */
-class AntifraudQueueTest extends BaseWmfDrupalPhpUnitTestCase {
-
-       /**
-        * @var AntifraudQueueConsumer
-        */
-       protected $consumer;
-
-       public function setUp() {
-               parent::setUp();
-               $config = QueueTestConfiguration::instance();
-               Context::initWithLogger( $config );
-               $queue = BaseQueueConsumer::getQueue( 'test' );
-               $queue->createTable( 'test' );
-               $this->consumer = new AntifraudQueueConsumer(
-                       'test'
-               );
-       }
-
-       public function testValidMessage() {
-               $message = json_decode(
-                       file_get_contents( __DIR__ . 
'/../data/payments-antifraud.json'),
-                       true
-               );
-               $ctId = mt_rand();
-               $oId = $ctId . '.0';
-               $message['contribution_tracking_id'] = $ctId;
-               $message['order_id'] = $oId;
-               $this->consumer->processMessage( $message );
-
-               $this->compareMessageWithDb( $message, 
$message['score_breakdown'] );
-       }
-
-       /**
-        * The first message for a ct_id / order_id pair needs to be complete
-        *
-        * @expectedException FredgeDataValidationException
-        */
-       public function testIncompleteMessage() {
-               $message = json_decode(
-                       file_get_contents( __DIR__ . 
'/../data/payments-antifraud.json'),
-                       true
-               );
-               unset( $message['user_ip'] );
-               $this->consumer->processMessage( $message );
-       }
-
-       public function testCombinedMessage() {
-               $message1 = json_decode(
-                       file_get_contents( __DIR__ . 
'/../data/payments-antifraud.json'),
-                       true
-               );
-               $message2 = json_decode(
-                       file_get_contents( __DIR__ . 
'/../data/payments-antifraud.json'),
-                       true
-               );
-               $ctId = mt_rand();
-               $oId = $ctId . '.0';
-               $message1['contribution_tracking_id'] = $ctId;
-               $message2['contribution_tracking_id'] = $ctId;
-               $message1['order_id'] = $oId;
-               $message2['order_id'] = $oId;
-               $message1['score_breakdown'] = array_slice(
-                       $message1['score_breakdown'], 0, 4
-               );
-               $message2['score_breakdown'] = array_slice(
-                       $message2['score_breakdown'], 4, 4
-               );
-               $this->consumer->processMessage( $message1 );
-
-               $dbEntries = $this->getDbEntries( $ctId, $oId );
-               $this->assertEquals( 4, count( $dbEntries ) );
-
-               $this->consumer->processMessage( $message2 );
-
-               $breakdown = array_merge(
-                       $message1['score_breakdown'], 
$message2['score_breakdown']
-               );
-
-               $this->compareMessageWithDb( $message1, $breakdown );
-       }
-
-       protected function compareMessageWithDb( $common, $breakdown ) {
-               $dbEntries = $this->getDbEntries(
-                       $common['contribution_tracking_id'], $common['order_id']
-               );
-               $this->assertEquals( 8, count( $dbEntries ) );
-               $fields = array(
-                       'gateway',  'validation_action', 'payment_method',
-                       'risk_score', 'server'
-               );
-               foreach ( $fields as $field ) {
-                       $this->assertEquals( $common[$field], 
$dbEntries[0][$field] );
-               }
-               $this->assertEquals( ip2long( $common['user_ip'] ), 
$dbEntries[0]['user_ip'] );
-               $this->assertEquals(
-                       $common['date'], wmf_common_date_civicrm_to_unix( 
$dbEntries[0]['date'] )
-               );
-               foreach ( $dbEntries as $score ) {
-                       $name = $score['filter_name'];
-                       $this->assertEquals(
-                               $breakdown[$name], $score['fb_risk_score'], 
"Mismatched $name score"
-                       );
-               }
-       }
-
-       protected function getDbEntries( $ctId, $orderId ) {
-               $query = Database::getConnection( 'default', 'fredge' )
-                       ->select( 'payments_fraud', 'f' );
-               $query->join(
-                       'payments_fraud_breakdown', 'fb', 'fb.payments_fraud_id 
= f.id'
-               );
-               return $query
-                       ->fields( 'f', array(
-                               'contribution_tracking_id', 'gateway', 
'order_id',
-                               'validation_action', 'user_ip', 
'payment_method',
-                               'risk_score', 'server', 'date'
-                       ) )
-                       ->fields( 'fb', array( 'filter_name', 'risk_score' ) )
-                       ->condition( 'contribution_tracking_id', $ctId )
-                       ->condition( 'order_id', $orderId )
-                       ->execute()
-                       ->fetchAll( PDO::FETCH_ASSOC );
-       }
-}
->>>>>>> BRANCH (ae5a92 Move donation queue consumer off ActiveMQ)
diff --git 
a/sites/all/modules/queue2civicrm/tests/phpunit/BannerHistoryTest.php 
b/sites/all/modules/queue2civicrm/tests/phpunit/BannerHistoryTest.php
deleted file mode 100644
index 76d0077..0000000
--- a/sites/all/modules/queue2civicrm/tests/phpunit/BannerHistoryTest.php
+++ /dev/null
@@ -1,66 +0,0 @@
-<<<<<<< HEAD   (d9209c Revert "Revert "Mirror messages to new queues in GC 
audit"")
-=======
-<?php
-use queue2civicrm\banner_history\BannerHistoryQueueConsumer;
-
-use SmashPig\Core\Context;
-use SmashPig\Core\QueueConsumers\BaseQueueConsumer;
-use SmashPig\Tests\QueueTestConfiguration;
-
-/**
- * @group Queue2Civicrm
- */
-class BannerHistoryTest extends BaseWmfDrupalPhpUnitTestCase {
-
-       /**
-        * @var BannerHistoryQueueConsumer
-        */
-       protected $consumer;
-
-       public function setUp() {
-               parent::setUp();
-               $config = QueueTestConfiguration::instance();
-               Context::initWithLogger( $config );
-               $queue = BaseQueueConsumer::getQueue( 'test' );
-               $queue->createTable( 'test' );
-               $this->consumer = new BannerHistoryQueueConsumer(
-                       'test'
-               );
-       }
-
-       public function testValidMessage() {
-               $msg = array(
-                       'banner_history_id' => substr(
-                               md5( mt_rand() . time() ), 0, 16
-                       ),
-                       'contribution_tracking_id' => strval( mt_rand() ),
-               );
-               $this->consumer->processMessage( $msg );
-               // check for thing in db
-       }
-
-       /**
-        * @expectedException WmfException
-        */
-       public function testBadContributionId() {
-               $msg = array(
-                       'banner_history_id' => substr(
-                               md5( mt_rand() . time() ), 0, 16
-                       ),
-                       'contribution_tracking_id' => '1=1; DROP TABLE 
students;--',
-               );
-               $this->consumer->processMessage( $msg );
-       }
-
-       /**
-        * @expectedException WmfException
-        */
-       public function testBadHistoryId() {
-               $msg = array(
-                       'banner_history_id' => '\';GRANT ALL ON drupal.* TO 
\'leet\'@\'haxx0r\'',
-                       'contribution_tracking_id' => strval( mt_rand() ),
-               );
-               $this->consumer->processMessage( $msg );
-       }
-}
->>>>>>> BRANCH (ae5a92 Move donation queue consumer off ActiveMQ)
diff --git 
a/sites/all/modules/queue2civicrm/tests/phpunit/PaymentsInitQueueTest.php 
b/sites/all/modules/queue2civicrm/tests/phpunit/PaymentsInitQueueTest.php
deleted file mode 100644
index c01f7b4..0000000
--- a/sites/all/modules/queue2civicrm/tests/phpunit/PaymentsInitQueueTest.php
+++ /dev/null
@@ -1,120 +0,0 @@
-<<<<<<< HEAD   (d9209c Revert "Revert "Mirror messages to new queues in GC 
audit"")
-=======
-<?php
-use queue2civicrm\fredge\PaymentsInitQueueConsumer;
-use SmashPig\Core\Context;
-use SmashPig\Core\QueueConsumers\BaseQueueConsumer;
-use SmashPig\Tests\QueueTestConfiguration;
-
-/**
- * @group Queue2Civicrm
- */
-class PaymentsInitQueueTest extends BaseWmfDrupalPhpUnitTestCase {
-
-       /**
-        * @var PaymentsInitQueueConsumer
-        */
-       protected $consumer;
-
-       public function setUp() {
-               parent::setUp();
-               $config = QueueTestConfiguration::instance();
-               Context::initWithLogger( $config );
-               $queue = BaseQueueConsumer::getQueue( 'test' );
-               $queue->createTable( 'test' );
-               $this->consumer = new PaymentsInitQueueConsumer(
-                       'test'
-               );
-       }
-
-       public function testValidMessage() {
-               $message = $this->getMessage();
-               $this->consumer->processMessage( $message );
-
-               $this->compareMessageWithDb( $message );
-       }
-
-       /**
-        * The first message for a ct_id / order_id pair needs to be complete
-        *
-        * @expectedException FredgeDataValidationException
-        */
-       public function testIncompleteMessage() {
-               $message = $this->getMessage();
-               unset( $message['payment_method'] );
-               $this->consumer->processMessage( $message );
-       }
-
-       /**
-        * After one complete message has been inserted, a second message
-        * with the same ct_id / order_id can update only selected fields
-        */
-       public function testUpdatedMessage() {
-               $message1 = $this->getMessage();
-               $message2 = $this->getMessage();
-               $message2['contribution_tracking_id'] = 
$message1['contribution_tracking_id'];
-               $message2['order_id'] = $message1['order_id'];
-
-               $message1['payments_final_status'] = 'pending';
-               $message2['payments_final_status'] = 'pending';
-               unset( $message2['payment_method'] );
-
-               $this->consumer->processMessage( $message1 );
-               $this->compareMessageWithDb( $message1 );
-
-               $this->consumer->processMessage( $message2 );
-               $updated = array_merge(
-                       $message1, $message2
-               );
-               $this->compareMessageWithDb( $updated );
-       }
-
-       protected function compareMessageWithDb( $message ) {
-               $dbEntries = $this->getDbEntries(
-                       $message['contribution_tracking_id'], 
$message['order_id']
-               );
-               $this->assertEquals( 1, count( $dbEntries ) );
-               $fields = array(
-                       'gateway',  'gateway_txn_id', 'validation_action',
-                       'payments_final_status', 'payment_method', 
'payment_submethod',
-                       'country', 'amount', 'currency_code', 'server'
-               );
-               foreach ( $fields as $field ) {
-                       $this->assertEquals( $message[$field], 
$dbEntries[0][$field] );
-               }
-               $this->assertEquals(
-                       $message['date'], wmf_common_date_civicrm_to_unix( 
$dbEntries[0]['date'] )
-               );
-       }
-
-       protected function getDbEntries( $ctId, $orderId ) {
-               return Database::getConnection( 'default', 'fredge' )
-                       ->select( 'payments_initial', 'f' )
-                       ->fields( 'f', array(
-                               'contribution_tracking_id', 'gateway', 
'order_id',
-                               'gateway_txn_id', 'validation_action', 
'payments_final_status',
-                               'payment_method', 'payment_submethod', 
'country', 'amount',
-                               'currency_code', 'server', 'date'
-                       ) )
-                       ->condition( 'contribution_tracking_id', $ctId )
-                       ->condition( 'order_id', $orderId )
-                       ->execute()
-                       ->fetchAll( PDO::FETCH_ASSOC );
-       }
-
-       /**
-        * @return array
-        */
-       protected function getMessage() {
-               $message = json_decode(
-                       file_get_contents( __DIR__ . 
'/../data/payments-init.json' ),
-                       true
-               );
-               $ctId = mt_rand();
-               $oId = $ctId . '.0';
-               $message['contribution_tracking_id'] = $ctId;
-               $message['order_id'] = $oId;
-               return $message;
-       }
-}
->>>>>>> BRANCH (ae5a92 Move donation queue consumer off ActiveMQ)
diff --git 
a/sites/all/modules/queue2civicrm/tests/phpunit/ProcessMessageTest.php 
b/sites/all/modules/queue2civicrm/tests/phpunit/ProcessMessageTest.php
deleted file mode 100644
index 8678fee..0000000
--- a/sites/all/modules/queue2civicrm/tests/phpunit/ProcessMessageTest.php
+++ /dev/null
@@ -1,351 +0,0 @@
-<<<<<<< HEAD   (d9209c Revert "Revert "Mirror messages to new queues in GC 
audit"")
-=======
-<?php
-
-use queue2civicrm\DonationQueueConsumer;
-use SmashPig\Core\Context;
-use SmashPig\Core\DataStores\PendingDatabase;
-use SmashPig\Tests\SmashPigDatabaseTestConfiguration;
-
-/**
- * @group Pipeline
- * @group Queue2Civicrm
- */
-class ProcessMessageTest extends BaseWmfDrupalPhpUnitTestCase {
-       /**
-        * @var PendingDatabase
-        */
-       protected $pendingDb;
-
-       /**
-        * @var DonationQueueConsumer
-        */
-       protected $queueConsumer;
-
-       public function setUp() {
-               parent::setUp();
-               $config = SmashPigDatabaseTestConfiguration::instance();
-               // FIXME: Use all-purpose SmashPig test config when ready
-               $config->override( array(
-                       'data-store' => array(
-                               'donations' => array(
-                                       'class' => 'PHPQueue\Backend\PDO',
-                                       'constructor-parameters' => array( 
array(
-                                               'connection_string' => 
'sqlite::memory:'
-                                       ) )
-                               )
-                       )
-               ) );
-               Context::initWithLogger( $config );
-               $this->pendingDb = PendingDatabase::get();
-               $this->pendingDb->createTable();
-               $this->queueConsumer = new DonationQueueConsumer( 'donations' );
-       }
-
-       /**
-     * Process an ordinary (one-time) donation message
-     */
-    public function testDonation() {
-        $message = new TransactionMessage();
-        $message2 = new TransactionMessage();
-
-        exchange_rate_cache_set( 'USD', $message->get( 'date' ), 1 );
-        exchange_rate_cache_set( $message->get( 'currency' ), $message->get( 
'date' ), 3 );
-
-        $this->queueConsumer->processMessage( $message->getBody() );
-        $this->queueConsumer->processMessage( $message2->getBody() );
-
-        $contributions = wmf_civicrm_get_contributions_from_gateway_id( 
$message->getGateway(), $message->getGatewayTxnId() );
-        $this->assertEquals( 1, count( $contributions ) );
-
-        $contributions2 = wmf_civicrm_get_contributions_from_gateway_id( 
$message2->getGateway(), $message2->getGatewayTxnId() );
-        $this->assertEquals( 1, count( $contributions2 ) );
-
-        $this->assertNotEquals( $contributions[0]['contact_id'], 
$contributions2[0]['contact_id'] );
-    }
-
-    /**
-     * Process an ordinary (one-time) donation message with an UTF campaign.
-     */
-    public function testDonationWithUTFCampaignOption() {
-        $message = new TransactionMessage(array('utm_campaign' => 
'EmailCampaign1'));
-        $appealFieldID = $this->createCustomOption('Appeal', 'EmailCampaign1');
-
-        exchange_rate_cache_set( 'USD', $message->get( 'date' ), 1 );
-        exchange_rate_cache_set( $message->get( 'currency' ), $message->get( 
'date' ), 3 );
-
-        $this->queueConsumer->processMessage( $message->getBody()  );
-
-        $contributions = wmf_civicrm_get_contributions_from_gateway_id( 
$message->getGateway(), $message->getGatewayTxnId() );
-        $contribution = civicrm_api3('Contribution', 'getsingle', array(
-            'id' => $contributions[0]['id'],
-            'return' => 'custom_' . $appealFieldID,
-        ));
-      $this->assertEquals('EmailCampaign1', $contribution['custom_' . 
$appealFieldID]);
-        $this->deleteCustomOption('Appeal', 'EmailCampaign1');
-    }
-
-  /**
-   * Process an ordinary (one-time) donation message with an UTF campaign not 
already existing.
-   */
-  public function testDonationWithInvalidUTFCampaignOption() {
-      civicrm_initialize();
-      $optionValue = uniqid();
-      $message = new TransactionMessage(array('utm_campaign' => $optionValue));
-      $appealField = civicrm_api3('custom_field', 'getsingle', array('name' => 
'Appeal'));
-
-      exchange_rate_cache_set('USD', $message->get('date'), 1);
-      exchange_rate_cache_set($message->get('currency'), 
$message->get('date'), 3);
-
-      $this->queueConsumer->processMessage( $message->getBody()  );
-
-      $contributions = 
wmf_civicrm_get_contributions_from_gateway_id($message->getGateway(), 
$message->getGatewayTxnId());
-      $contribution = civicrm_api3('Contribution', 'getsingle', array(
-        'id' => $contributions[0]['id'],
-        'return' => 'custom_' . $appealField['id'],
-      ));
-      $this->assertEquals($optionValue, $contribution['custom_' . 
$appealField['id']]);
-      $this->deleteCustomOption('Appeal', $optionValue);
-  }
-
-  /**
-   * Process an ordinary (one-time) donation message with an UTF campaign 
previously disabled.
-   */
-  public function testDonationWithDisabledUTFCampaignOption() {
-    civicrm_initialize();
-    $optionValue = uniqid();
-    $message = new TransactionMessage(array('utm_campaign' => $optionValue));
-    $appealFieldID = $this->createCustomOption('Appeal', $optionValue, FALSE);
-
-    exchange_rate_cache_set('USD', $message->get('date'), 1);
-    exchange_rate_cache_set($message->get('currency'), $message->get('date'), 
3);
-
-    $this->queueConsumer->processMessage( $message->getBody() );
-
-    $contributions = 
wmf_civicrm_get_contributions_from_gateway_id($message->getGateway(), 
$message->getGatewayTxnId());
-    $contribution = civicrm_api3('Contribution', 'getsingle', array(
-      'id' => $contributions[0]['id'],
-      'return' => 'custom_' . $appealFieldID,
-    ));
-    $this->assertEquals($optionValue, $contribution['custom_' . 
$appealFieldID]);
-    $this->deleteCustomOption('Appeal', $optionValue);
-  }
-
-  /**
-   * Create a custom option for the given field.
-   *
-   * @param string $fieldName
-   *
-   * @param string $optionValue
-   * @param bool $is_active
-   *   Is the option value enabled.
-   *
-   * @return mixed
-   * @throws \CiviCRM_API3_Exception
-   */
-    public function createCustomOption($fieldName, $optionValue, $is_active = 
1) {
-        $appealField = civicrm_api3('custom_field', 'getsingle', array('name' 
=> $fieldName));
-        civicrm_api3('OptionValue', 'create', array(
-          'name' => $optionValue,
-          'value' => $optionValue,
-          'option_group_id' => $appealField['option_group_id'],
-          'is_active' => $is_active,
-        ));
-        
civicrm_api_option_group(wmf_civicrm_get_direct_mail_field_option_name(), null, 
TRUE);
-        return $appealField['id'];
-    }
-
-    /**
-     * Cleanup custom field option after test.
-     *
-     * @param string $fieldName
-     *
-     * @param string $optionValue
-     *
-     * @return mixed
-     * @throws \CiviCRM_API3_Exception
-     */
-    public function deleteCustomOption($fieldName, $optionValue) {
-        $appealField = civicrm_api3('custom_field', 'getsingle', array('name' 
=> $fieldName));
-        return $appealField['id'];
-    }
-
-    public function testRecurring() {
-        $subscr_id = mt_rand();
-        $values = array( 'subscr_id' => $subscr_id );
-        $signup_message = new RecurringSignupMessage( $values );
-        $message = new RecurringPaymentMessage( $values );
-        $message2 = new RecurringPaymentMessage( $values );
-
-        $subscr_time = strtotime( $signup_message->get( 'subscr_date' ) );
-        exchange_rate_cache_set( 'USD', $subscr_time, 1 );
-        exchange_rate_cache_set( $signup_message->get('mc_currency'), 
$subscr_time, 3 );
-        $payment_time = strtotime( $message->get( 'payment_date' ) );
-        exchange_rate_cache_set( 'USD', $payment_time, 1 );
-        exchange_rate_cache_set( $message->get('mc_currency'), $payment_time, 
3 );
-
-        recurring_import( $signup_message );
-        recurring_import( $message );
-        recurring_import( $message2 );
-
-        $recur_record = wmf_civicrm_get_recur_record( $subscr_id );
-        $this->assertNotEquals( false, $recur_record );
-
-        $contributions = wmf_civicrm_get_contributions_from_gateway_id( 
$message->getGateway(), $message->getGatewayTxnId() );
-        $this->assertEquals( 1, count( $contributions ) );
-        $this->assertEquals( $recur_record->id, 
$contributions[0]['contribution_recur_id']);
-
-        $contributions2 = wmf_civicrm_get_contributions_from_gateway_id( 
$message2->getGateway(), $message2->getGatewayTxnId() );
-        $this->assertEquals( 1, count( $contributions2 ) );
-        $this->assertEquals( $recur_record->id, 
$contributions2[0]['contribution_recur_id']);
-
-        $this->assertEquals( $contributions[0]['contact_id'], 
$contributions2[0]['contact_id'] );
-    }
-
-    /**
-     * @expectedException WmfException
-     * @expectedExceptionCode WmfException::MISSING_PREDECESSOR
-     */
-    public function testRecurringNoPredecessor() {
-        $message = new RecurringPaymentMessage( array(
-            'subscr_id' => mt_rand(),
-        ) );
-
-        $payment_time = strtotime( $message->get( 'payment_date' ) );
-        exchange_rate_cache_set( 'USD', $payment_time, 1 );
-        exchange_rate_cache_set( $message->get('mc_currency'), $payment_time, 
3 );
-
-        recurring_import( $message );
-    }
-
-    /**
-     * @expectedException WmfException
-     * @expectedExceptionCode WmfException::INVALID_RECURRING
-     */
-    public function testRecurringNoSubscrId() {
-        $message = new RecurringPaymentMessage( array(
-            'subscr_id' => null,
-        ) );
-
-        $payment_time = strtotime( $message->get( 'payment_date' ) );
-        exchange_rate_cache_set( 'USD', $payment_time, 1 );
-        exchange_rate_cache_set( $message->get('mc_currency'), $payment_time, 
3 );
-
-        recurring_import( $message );
-    }
-
-    public function testRefund() {
-        $donation_message = new TransactionMessage();
-        $refund_message = new RefundMessage( array(
-            'gateway' => $donation_message->getGateway(),
-            'gateway_parent_id' => $donation_message->getGatewayTxnId(),
-            'gateway_refund_id' => mt_rand(),
-            'gross' => $donation_message->get( 'original_gross' ),
-            'gross_currency' => $donation_message->get( 'original_currency' ),
-        ) );
-
-        exchange_rate_cache_set( 'USD', $donation_message->get('date'), 1 );
-        exchange_rate_cache_set( $donation_message->get('currency'), 
$donation_message->get('date'), 3 );
-
-        $this->queueConsumer->processMessage( $donation_message->getBody() );
-        $contributions = wmf_civicrm_get_contributions_from_gateway_id( 
$donation_message->getGateway(), $donation_message->getGatewayTxnId() );
-        $this->assertEquals( 1, count( $contributions ) );
-
-        refund_import( $refund_message );
-        $contributions = wmf_civicrm_get_contributions_from_gateway_id( 
$refund_message->getGateway(), $refund_message->getGatewayTxnId() );
-        $this->assertEquals( 1, count( $contributions ) );
-    }
-
-    /**
-     * @expectedException WmfException
-     * @expectedExceptionCode WmfException::MISSING_PREDECESSOR
-     */
-    public function testRefundNoPredecessor() {
-        $refund_message = new RefundMessage();
-
-        refund_import( $refund_message );
-    }
-
-    /**
-     * Test refunding a mismatched amount.
-     *
-     * Note that we were checking against an exception - but it turned out the 
exception
-     * could be thrown in this fn $this->queueConsumer->processMessage if the 
exchange rate does not
-     * exist - which is not what we are testing for.
-     */
-    public function testRefundMismatched() {
-        $this->setExchangeRates(1234567, array( 'USD' => 1, 'PLN' => 0.5 ) );
-        $donation_message = new TransactionMessage( array(
-            'gateway' => 'test_gateway',
-            'gateway_txn_id' => mt_rand(),
-        ) );
-        $refund_message = new RefundMessage( array(
-            'gateway' => 'test_gateway',
-            'gateway_parent_id' => $donation_message->getGatewayTxnId(),
-            'gateway_refund_id' => mt_rand(),
-            'gross' => $donation_message->get( 'original_gross' ) + 1,
-            'gross_currency' => $donation_message->get( 'original_currency' ),
-        ) );
-
-        $this->queueConsumer->processMessage( $donation_message->getBody() );
-        $contributions = wmf_civicrm_get_contributions_from_gateway_id( 
$donation_message->getGateway(), $donation_message->getGatewayTxnId() );
-        $this->assertEquals( 1, count( $contributions ) );
-
-        refund_import( $refund_message );
-        $contributions = $this->callAPISuccess('Contribution', 'get', 
array('contact_id' => $contributions[0]['contact_id'], 'sequential' => 1));
-        $this->assertEquals(2, count($contributions['values']));
-        $this->assertEquals('Chargeback', 
CRM_Contribute_PseudoConstant::contributionStatus($contributions['values'][0]['contribution_status_id']));
-        $this->assertEquals('-.5', 
$contributions['values'][1]['total_amount']);
-    }
-
-       /**
-        * Process a donation message with some info from pending db
-        * @dataProvider getSparseMessages
-        * @param TransactionMessage $message
-        * @param array $pendingMessage
-        */
-       public function testDonationSparseMessages( $message, $pendingMessage ) 
{
-               $pendingMessage['order_id'] = $message->get( 'order_id' );
-               $this->pendingDb->storeMessage( $pendingMessage );
-               $appealFieldID = $this->createCustomOption(
-                       'Appeal', $pendingMessage['utm_campaign'], false
-               );
-
-               exchange_rate_cache_set( 'USD', $message->get( 'date' ), 1 );
-               exchange_rate_cache_set( $message->get( 'currency' ), 
$message->get( 'date' ), 3 );
-
-               $this->queueConsumer->processMessage( $message->getBody()  );
-
-               $contributions = wmf_civicrm_get_contributions_from_gateway_id( 
$message->getGateway(), $message->getGatewayTxnId() );
-               $contribution = civicrm_api3('Contribution', 'getsingle', array(
-                       'id' => $contributions[0]['id'],
-                       'return' => 'custom_' . $appealFieldID,
-               ));
-               $this->assertEquals( $pendingMessage['utm_campaign'], 
$contribution['custom_' . $appealFieldID]);
-               $this->deleteCustomOption('Appeal', 
$pendingMessage['utm_campaign']);
-               $pendingEntry = $this->pendingDb->fetchMessageByGatewayOrderId(
-                       $message->get( 'gateway' ), $pendingMessage['order_id']
-               );
-               $this->assertNull( $pendingEntry, 'Should have deleted pending 
DB entry' );
-               civicrm_api3( 'Contribution', 'delete', array( 'id' => 
$contributions[0]['id'] ) );
-               civicrm_api3( 'Contact', 'delete', array( 'id' => 
$contributions[0]['contact_id'] ) );
-       }
-
-       public function getSparseMessages() {
-               return array(
-                       array(
-                               new AmazonDonationMessage(),
-                               json_decode(
-                                       file_get_contents( __DIR__ . 
'/../data/pending_amazon.json'), true
-                               )
-                       ),
-                       array(
-                               new AstroPayDonationMessage(),
-                               json_decode(
-                                       file_get_contents( __DIR__ . 
'/../data/pending_astropay.json'), true
-                               )
-                       ),
-               );
-       }
-}
->>>>>>> BRANCH (ae5a92 Move donation queue consumer off ActiveMQ)
diff --git a/sites/all/modules/wmf_audit/tests/AdyenAuditTest.php 
b/sites/all/modules/wmf_audit/tests/AdyenAuditTest.php
deleted file mode 100644
index 3661f01..0000000
--- a/sites/all/modules/wmf_audit/tests/AdyenAuditTest.php
+++ /dev/null
@@ -1,186 +0,0 @@
-<<<<<<< HEAD   (d9209c Revert "Revert "Mirror messages to new queues in GC 
audit"")
-=======
-<?php
-
-/**
- * @group Adyen
- * @group WmfAudit
- */
-class AdyenAuditTest extends BaseWmfDrupalPhpUnitTestCase {
-       static protected $messages;
-
-       protected $contact_id;
-       protected $contribution_ids = array();
-
-       public function setUp() {
-               parent::setUp();
-               self::$messages = array();
-
-               $dirs = array(
-                       'wmf_audit_log_archive_dir' => __DIR__ . '/data/logs/',
-                       'adyen_audit_recon_completed_dir' => 
$this->getTempDir(),
-                       'adyen_audit_working_log_dir' => $this->getTempDir(),
-               );
-
-               foreach ( $dirs as $var => $dir ) {
-                       if ( !is_dir( $dir ) ) {
-                               mkdir( $dir );
-                       }
-                       variable_set( $var, $dir );
-               }
-
-               $old_working = glob( $dirs['adyen_audit_working_log_dir'] . '*' 
);
-               foreach ( $old_working as $zap ) {
-                       if ( is_file( $zap ) ) {
-                               unlink( $zap );
-                       }
-               }
-
-               variable_set( 'adyen_audit_log_search_past_days', 7 );
-
-               // Fakedb doesn't fake the original txn for refunds, so add one 
here
-               $existing = wmf_civicrm_get_contributions_from_gateway_id( 
'adyen', '4522268860022701' );
-               if ( $existing ) {
-                       // Previous test run may have crashed before cleaning up
-                       $contribution = $existing[0];
-               } else {
-                       $msg = array(
-                               'contribution_tracking_id' => 92598312,
-                               'currency' => 'USD',
-                               'date' => 1455825706,
-                               'email' => 'a...@asdf.com',
-                               'gateway' => 'adyen',
-                               'gateway_txn_id' => '4522268860022701',
-                               'gross' => 1.00,
-                               'payment_method' => 'cc',
-                       );
-                       $contribution = 
wmf_civicrm_contribution_message_import( $msg );
-               }
-               $this->contact_id = $contribution['contact_id'];
-               $this->contribution_ids[] = $contribution['id'];
-
-               // and another for the chargeback
-               $existing = wmf_civicrm_get_contributions_from_gateway_id( 
'adyen', '4555568860022701' );
-               if ( $existing ) {
-                       // Previous test run may have crashed before cleaning up
-                       $contribution = $existing[0];
-               } else {
-                       $msg = array(
-                               'contribution_tracking_id' => 92598318,
-                               'currency' => 'USD',
-                               'date' => 1443724034,
-                               'email' => 'a...@asdf.org',
-                               'gateway' => 'adyen',
-                               'gateway_txn_id' => '4555568860022701',
-                               'gross' => 1.00,
-                               'payment_method' => 'cc',
-                       );
-                       $contribution = 
wmf_civicrm_contribution_message_import( $msg );
-               }
-               $this->contact_id = $contribution['contact_id'];
-               $this->contribution_ids[] = $contribution['id'];
-       }
-
-       public function tearDown() {
-               $api = civicrm_api_classapi();
-               foreach( $this->contribution_ids as $id ) {
-                       $api->Contribution->Delete( array(
-                               'id' => $id,
-                               'version' => 3,
-                       ) );
-               }
-               $api->Contact->Delete( array(
-                       'id' => $this->contact_id,
-                       'version' => 3,
-               ) );
-               parent::tearDown();
-       }
-
-       public function auditTestProvider() {
-               return array(
-                       array( __DIR__ . '/data/Adyen/donation/', array(
-                               'main' => array(
-                                       array(
-                                               'contribution_tracking_id' => 
'33992337',
-                                               'country' => 'US',
-                                               'currency' => 'USD',
-                                               'date' => 1455862251,
-                                               'email' => 'a...@asdf.com',
-                                               'fee' => '0.24',
-                                               'first_name' => 'asdf',
-                                               'gateway' => 'adyen',
-                                               'gateway_account' => 
'TestMerchant',
-                                               'gateway_txn_id' => 
'5364893193133131',
-                                               'gross' => '1.00',
-                                               'language' => 'en',
-                                               'last_name' => 'asdff',
-                                               'order_id' => '33992337.0',
-                                               'payment_method' => 'cc',
-                                               'payment_submethod' => 'visa',
-                                               'user_ip' => '77.177.177.77',
-                                               'utm_campaign' => 
'C13_en.wikipedia.org',
-                                               'utm_medium' => 'sidebar',
-                                               'utm_source' => '..cc',
-                                               'settled_gross' => '0.76',
-                                               'settled_currency' => 'USD',
-                                               'settled_fee' => '0.24',
-                                       ),
-                               ),
-                       ) ),
-                array( __DIR__ . '/data/Adyen/refund/', array(
-                               'negative' => array(
-                                       array(
-                                               'date' => 1455128736,
-                                               'gateway' => 'adyen',
-                                               'gateway_parent_id' => 
'4522268860022701',
-                                               'gateway_refund_id' => 
'4522268869855336',
-                                               'gross' => '1.00',
-                                               'gross_currency' => 'USD',
-                                               'type' => 'refund',
-                                       ),
-                               ),
-                       ) ),
-                array( __DIR__ . '/data/Adyen/chargeback/', array(
-                               'negative' => array(
-                                       array(
-                                               'date' => 1455128736,
-                                               'gateway' => 'adyen',
-                                               'gateway_parent_id' => 
'4555568860022701',
-                                               'gateway_refund_id' => 
'4555568869855336',
-                                               'gross' => '1.00',
-                                               'gross_currency' => 'USD',
-                                               'type' => 'chargeback',
-                                       ),
-                               ),
-                       ) ),
-               );
-       }
-
-       /**
-        * @dataProvider auditTestProvider
-        */
-       public function testParseFiles( $path, $expectedMessages ) {
-               variable_set( 'adyen_audit_recon_files_dir', $path );
-
-               $this->runAuditor();
-
-               $this->assertEquals( $expectedMessages, self::$messages );
-       }
-
-       protected function runAuditor() {
-               $options = array(
-                       'fakedb' => true,
-                       'quiet' => true,
-                       'test' => true,
-                       'test_callback' => array( 'AdyenAuditTest', 
'receiveMessages' ),
-                       #'verbose' => 'true', # Uncomment to debug.
-               );
-               $audit = new AdyenAuditProcessor( $options );
-               $audit->run();
-       }
-
-       static public function receiveMessages( $msg, $type ) {
-               self::$messages[$type][] = $msg;
-       }
-}
->>>>>>> BRANCH (ae5a92 Move donation queue consumer off ActiveMQ)
diff --git a/sites/all/modules/wmf_audit/tests/AmazonAuditTest.php 
b/sites/all/modules/wmf_audit/tests/AmazonAuditTest.php
deleted file mode 100644
index df50485..0000000
--- a/sites/all/modules/wmf_audit/tests/AmazonAuditTest.php
+++ /dev/null
@@ -1,167 +0,0 @@
-<<<<<<< HEAD   (d9209c Revert "Revert "Mirror messages to new queues in GC 
audit"")
-=======
-<?php
-
-use SmashPig\Core\Context;
-use SmashPig\PaymentProviders\Amazon\Tests\AmazonTestConfiguration;
-
-/**
- * @group Amazon
- * @group WmfAudit
- */
-class AmazonAuditTest extends BaseWmfDrupalPhpUnitTestCase {
-       static protected $messages;
-
-       protected $contact_id;
-       protected $contribution_id;
-
-       public function setUp() {
-               parent::setUp();
-               self::$messages = array();
-
-               // Use the test configuration for SmashPig
-               $config = AmazonTestConfiguration::instance();
-               Context::initWithLogger( $config );
-
-               $dirs = array(
-                       'wmf_audit_log_archive_dir' => __DIR__ . '/data/logs/',
-                       'amazon_audit_recon_completed_dir' => 
$this->getTempDir(),
-                       'amazon_audit_working_log_dir' => $this->getTempDir(),
-               );
-
-               foreach ( $dirs as $var => $dir ) {
-                       if ( !is_dir( $dir ) ) {
-                               mkdir( $dir );
-                       }
-                       variable_set( $var, $dir );
-               }
-
-               $old_working = glob( $dirs['amazon_audit_working_log_dir'] . 
'*' );
-               foreach ( $old_working as $zap ) {
-                       if ( is_file( $zap ) ) {
-                               unlink( $zap );
-                       }
-               }
-
-               variable_set( 'amazon_audit_log_search_past_days', 7 );
-
-               // Fakedb doesn't fake the original txn for refunds, so add one 
here
-               $existing = wmf_civicrm_get_contributions_from_gateway_id( 
'amazon', 'P01-4968629-7654321-C070794' );
-               if ( $existing ) {
-                       // Previous test run may have crashed before cleaning up
-                       $contribution = $existing[0];
-               } else {
-                       $msg = array(
-                               'contribution_tracking_id' => 2476135333,
-                               'currency' => 'USD',
-                               'date' => 1443724034,
-                               'email' => 'lu...@yahoo.com',
-                               'gateway' => 'amazon',
-                               'gateway_txn_id' => 
'P01-4968629-7654321-C070794',
-                               'gross' => 1.00,
-                               'payment_method' => 'amazon',
-                       );
-                       $contribution = 
wmf_civicrm_contribution_message_import( $msg );
-               }
-               $this->contact_id = $contribution['contact_id'];
-               $this->contribution_id = $contribution['id'];
-       }
-
-       public function tearDown() {
-               $api = civicrm_api_classapi();
-               $api->Contribution->Delete( array(
-                       'id' => $this->contribution_id,
-                       'version' => 3,
-               ) );
-               $api->Contact->Delete( array(
-                       'id' => $this->contact_id,
-                       'version' => 3,
-               ) );
-               parent::tearDown();
-       }
-
-       public function auditTestProvider() {
-               return array(
-                       array( __DIR__ . '/data/Amazon/donation/', array(
-                               'main' => array(
-                                       array(
-                                               'contribution_tracking_id' => 
'87654321',
-                                               'country' => 'US',
-                                               'currency' => 'USD',
-                                               'date' => 1443723034,
-                                               'email' => 
'nonchal...@gmail.com',
-                                               'fee' => '0.59',
-                                               'first_name' => 'Test',
-                                               'gateway' => 'amazon',
-                                               'gateway_account' => 'default',
-                                               'gateway_txn_id' => 
'P01-1488694-1234567-C034811',
-                                               'gross' => '10.00',
-                                               'language' => 'en',
-                                               'last_name' => 'Person',
-                                               'order_id' => '87654321-0',
-                                               'payment_method' => 'amazon',
-                                               'payment_submethod' => '',
-                                               'user_ip' => '1.2.3.4',
-                                               'utm_campaign' => 
'C13_en.wikipedia.org',
-                                               'utm_medium' => 'sidebar',
-                                               'utm_source' => '..amazon',
-                                       ),
-                               ),
-                       ) ),
-                array( __DIR__ . '/data/Amazon/refund/', array(
-                               'negative' => array(
-                                       array(
-                                               'date' => 1444087249,
-                                               'gateway' => 'amazon',
-                                               'gateway_parent_id' => 
'P01-4968629-7654321-C070794',
-                                               'gateway_refund_id' => 
'P01-4968629-7654321-R017571',
-                                               'gross' => '1.00',
-                                               'gross_currency' => 'USD',
-                                               'type' => 'refund',
-                                       ),
-                               ),
-                       ) ),
-                array( __DIR__ . '/data/Amazon/chargeback/', array(
-                               'negative' => array(
-                                       array(
-                                               'date' => 1444087249,
-                                               'gateway' => 'amazon',
-                                               'gateway_parent_id' => 
'P01-4968629-7654321-C070794',
-                                               'gateway_refund_id' => 
'P01-4968629-7654321-R017571',
-                                               'gross' => '1.00',
-                                               'gross_currency' => 'USD',
-                                               'type' => 'chargeback',
-                                       ),
-                               ),
-                       ) ),
-               );
-       }
-
-       /**
-        * @dataProvider auditTestProvider
-        */
-       public function testParseFiles( $path, $expectedMessages ) {
-               variable_set( 'amazon_audit_recon_files_dir', $path );
-
-               $this->runAuditor();
-
-               $this->assertEquals( $expectedMessages, self::$messages );
-       }
-
-       protected function runAuditor() {
-               $options = array(
-                       'fakedb' => true,
-                       'quiet' => true,
-                       'test' => true,
-                       'test_callback' => array( 'AmazonAuditTest', 
'receiveMessages' ),
-                       #'verbose' => 'true', # Uncomment to debug.
-               );
-               $audit = new AmazonAuditProcessor( $options );
-               $audit->run();
-       }
-
-       static public function receiveMessages( $msg, $type ) {
-               self::$messages[$type][] = $msg;
-       }
-}
->>>>>>> BRANCH (ae5a92 Move donation queue consumer off ActiveMQ)
diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.module 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
index a254de2..e23f6a5 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.module
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
@@ -1004,25 +1004,6 @@
 }
 
 /**
- * Throw an exception if a contribution already exists
- *
- * @param string $gateway
- * @param string $gateway_txn_id
- * @throws WmfException
- */
-function wmf_civicrm_check_for_duplicates( $gateway, $gateway_txn_id ) {
-    $txn = wmf_civicrm_get_contributions_from_gateway_id(
-        $gateway, $gateway_txn_id
-    );
-    if ( $txn ) {
-        throw new WmfException(
-            'DUPLICATE_CONTRIBUTION',
-            'Contribution already exists. Ignoring message.'
-        );
-    }
-}
-
-/**
  * Insert the contact record
  *
  * Serves as a standard way for message processors to handle contact
diff --git 
a/sites/all/modules/wmf_common/tests/includes/BaseWmfDrupalPhpUnitTestCase.php 
b/sites/all/modules/wmf_common/tests/includes/BaseWmfDrupalPhpUnitTestCase.php
deleted file mode 100644
index e396b79..0000000
--- 
a/sites/all/modules/wmf_common/tests/includes/BaseWmfDrupalPhpUnitTestCase.php
+++ /dev/null
@@ -1,149 +0,0 @@
-<<<<<<< HEAD   (d9209c Revert "Revert "Mirror messages to new queues in GC 
audit"")
-=======
-<?php
-
-use SmashPig\Core\Context;
-
-class BaseWmfDrupalPhpUnitTestCase extends PHPUnit_Framework_TestCase {
-    public function setUp() {
-        parent::setUp();
-
-        if ( !defined( 'DRUPAL_ROOT' ) ) {
-            throw new Exception( "Define DRUPAL_ROOT somewhere before running 
unit tests." );
-        }
-
-        global $user, $_exchange_rate_cache;
-        $_exchange_rate_cache = array();
-
-        $user = new stdClass();
-        $user->name = "foo_who";
-        $user->uid = "321";
-        $user->roles = array( DRUPAL_AUTHENTICATED_RID => 'authenticated user' 
);
-    }
-
-    public function tearDown() {
-               Context::set( null ); // Nullify any SmashPig context for the 
next run
-               parent::tearDown();
-       }
-
-       /**
-        * Temporarily set foreign exchange rates to known values
-        *
-        * TODO: Should reset after each test.
-        */
-       protected function setExchangeRates( $timestamp, $rates ) {
-               foreach ( $rates as $currency => $rate ) {
-                       exchange_rate_cache_set( $currency, $timestamp, $rate );
-               }
-       }
-
-       /**
-        * Create a temporary directory and return the name
-        * @return string|boolean directory path if creation was successful, or 
false
-        */
-       protected function getTempDir() {
-               $tempFile = tempnam( sys_get_temp_dir(), 'wmfDrupalTest_' );
-               if ( file_exists( $tempFile ) ) {
-                       unlink( $tempFile );
-               }
-               mkdir( $tempFile );
-               if ( is_dir( $tempFile ) ) {
-                       return $tempFile . '/';
-               }
-               return false;
-       }
-
-    /**
-     * API wrapper function from core (more or less).
-     *
-     * so we can ensure they succeed & throw exceptions without littering the 
test with checks.
-     *
-     * This is not the full function but it we think it'w worth keeping a copy 
it should maybe
-     * go in the parent.
-     *
-     * @param string $entity
-     * @param string $action
-     * @param array $params
-     * @param mixed $checkAgainst
-     *   Optional value to check result against, implemented for getvalue,.
-     *   getcount, getsingle. Note that for getvalue the type is checked 
rather than the value
-     *   for getsingle the array is compared against an array passed in - the 
id is not compared (for
-     *   better or worse )
-     *
-     * @return array|int
-     */
-    public function callAPISuccess($entity, $action, $params, $checkAgainst = 
NULL) {
-        $params = array_merge(array(
-            'version' => 3,
-            'debug' => 1,
-        ),
-            $params
-        );
-        try {
-            $result = civicrm_api3($entity, $action, $params);
-        }
-        catch (CiviCRM_API3_Exception $e) {
-            $this->assertEquals(0, $e->getMessage() . 
print_r($e->getExtraParams(), TRUE));
-        }
-        $this->assertAPISuccess($result, "Failure in api call for $entity 
$action");
-        return $result;
-    }
-
-    /**
-     * Check that api returned 'is_error' => 0.
-     *
-     * @param array $apiResult
-     *   Api result.
-     * @param string $prefix
-     *   Extra test to add to message.
-     */
-    public function assertAPISuccess($apiResult, $prefix = '') {
-        if (!empty($prefix)) {
-            $prefix .= ': ';
-        }
-        $errorMessage = empty($apiResult['error_message']) ? '' : " " . 
$apiResult['error_message'];
-
-        if (!empty($apiResult['debug_information'])) {
-            $errorMessage .= "\n " . print_r($apiResult['debug_information'], 
TRUE);
-        }
-        if (!empty($apiResult['trace'])) {
-            $errorMessage .= "\n" . print_r($apiResult['trace'], TRUE);
-        }
-        $this->assertEquals(0, $apiResult['is_error'], $prefix . 
$errorMessage);
-    }
-
-
-  /**
-   * Emulate a logged in user since certain functions use that.
-   * value to store a record in the DB (like activity)
-   * CRM-8180
-   *
-   * @return int
-   *   Contact ID of the created user.
-   */
-  public function imitateAdminUser() {
-    $result = $this->callAPISuccess('UFMatch', 'get', array(
-      'uf_id' => 1,
-      'sequential' => 1,
-    ));
-    if (empty($result['id'])) {
-      $contact = $this->callAPISuccess('Contact', 'create', array(
-        'first_name' => 'Super',
-        'last_name' => 'Duper',
-        'contact_type' => 'Individual',
-        'api.UFMatch.create' => array('uf_id' => 1, 'uf_name' => 'Wizard'),
-      ));
-      $contactID = $contact['id'];
-    }
-    else {
-      $contactID = $result['values'][0]['contact_id'];
-    }
-    $session = CRM_Core_Session::singleton();
-    $session->set('userID', $contactID);
-    CRM_Core_Config::singleton()->userPermissionClass = new 
CRM_Core_Permission_UnitTests();
-    CRM_Core_Config::singleton()->userPermissionClass->permissions = 
array('Edit All Contacts', 'Access CiviCRM', 'Administer CiviCRM');
-    return $contactID;
-  }
-
-}
->>>>>>> BRANCH (ae5a92 Move donation queue consumer off ActiveMQ)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id792d619a41a6b787c784154e6f914bd6dfa628b
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
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

Reply via email to