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

Change subject: Extend test to ensure double addresses not created.
......................................................................

Extend test to ensure double addresses not created.

Bug: T152475
Change-Id: Ia744f3455552aa0ca61cf8196867edb3a58df39a
---
M sites/all/modules/queue2civicrm/tests/phpunit/ProcessMessageTest.php
1 file changed, 15 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/18/328118/1

diff --git 
a/sites/all/modules/queue2civicrm/tests/phpunit/ProcessMessageTest.php 
b/sites/all/modules/queue2civicrm/tests/phpunit/ProcessMessageTest.php
index 86ccc4e..a0e48ae 100644
--- a/sites/all/modules/queue2civicrm/tests/phpunit/ProcessMessageTest.php
+++ b/sites/all/modules/queue2civicrm/tests/phpunit/ProcessMessageTest.php
@@ -230,6 +230,7 @@
     }
 
     public function testRecurring() {
+        civicrm_initialize();
         $subscr_id = mt_rand();
         $values = array( 'subscr_id' => $subscr_id );
         $signup_message = new RecurringSignupMessage( $values );
@@ -243,8 +244,14 @@
         exchange_rate_cache_set( 'USD', $payment_time, 1 );
         exchange_rate_cache_set( $message->get('mc_currency'), $payment_time, 
3 );
 
-        $this->recurringConsumer->processMessage( $signup_message->getBody() );
-        $this->recurringConsumer->processMessage( $message->getBody() );
+        $this->recurringConsumer->processMessage($signup_message->getBody());
+
+        $msg = $message->getBody();
+        db_insert('contribution_tracking')
+          ->fields(array('id' => $msg['custom']))
+        ->execute();
+
+        $this->recurringConsumer->processMessage($msg);
         $this->recurringConsumer->processMessage( $message2->getBody() );
 
         $recur_record = wmf_civicrm_get_recur_record( $subscr_id );
@@ -259,6 +266,12 @@
         $this->assertEquals( $recur_record->id, 
$contributions2[0]['contribution_recur_id']);
 
         $this->assertEquals( $contributions[0]['contact_id'], 
$contributions2[0]['contact_id'] );
+        $addresses = $this->callAPISuccess('Address', 'get', 
array('contact_id' => $contributions2[0]['contact_id']));
+        $this->assertEquals(1, $addresses['count']);
+        $this->assertEquals('5109 Lockwood Rd', 
$addresses['values'][$addresses['id']]['street_address']);
+        db_delete('contribution_tracking')
+        ->condition('id', $msg['custom'])
+        ->execute();
     }
 
     /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia744f3455552aa0ca61cf8196867edb3a58df39a
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen <emcnaugh...@wikimedia.org>

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

Reply via email to