jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/340885 )

Change subject: Test more fields on donation import
......................................................................


Test more fields on donation import

Make sure we have things like the donor name!

Change-Id: I4d595f751866b3eb135d421ac21018b30a998d14
---
M sites/all/modules/queue2civicrm/tests/phpunit/ProcessMessageTest.php
1 file changed, 43 insertions(+), 5 deletions(-)

Approvals:
  jenkins-bot: Verified
  Awight: Looks good to me, approved



diff --git 
a/sites/all/modules/queue2civicrm/tests/phpunit/ProcessMessageTest.php 
b/sites/all/modules/queue2civicrm/tests/phpunit/ProcessMessageTest.php
index c1d2284..8038970 100644
--- a/sites/all/modules/queue2civicrm/tests/phpunit/ProcessMessageTest.php
+++ b/sites/all/modules/queue2civicrm/tests/phpunit/ProcessMessageTest.php
@@ -79,19 +79,57 @@
         $this->queueConsumer->processMessage( $message->getBody() );
         $this->queueConsumer->processMessage( $message2->getBody() );
 
+        $campaignField = wmf_civicrm_get_custom_field_name('campaign');
+
+        $expected = array(
+          'contact_type' => 'Individual',
+          'sort_name' => 'laast, firrst',
+          'display_name' => 'firrst laast',
+          'first_name' => 'firrst',
+          'last_name' => 'laast',
+          'currency' => 'USD',
+          'total_amount' => '400.00',
+          'fee_amount' => '0.00',
+          'net_amount' => '400.00',
+          'trxn_id' => 'GLOBALCOLLECT ' . $message->getGatewayTxnId(),
+          'contribution_source' => 'USD 400',
+          'financial_type' => 'Cash',
+          'contribution_status' => 'Completed',
+          'payment_instrument' => 'Credit Card: Visa',
+          $campaignField => '',
+        );
+        $returnFields = array_keys( $expected );
+
         $contribution = civicrm_api3('Contribution', 'getsingle', array(
           wmf_civicrm_get_custom_field_name('gateway_txn_id') => 
$message->getGatewayTxnId(),
-          'return' => array(wmf_civicrm_get_custom_field_name('Campaign'), 
'total_amount'),
+          'return' => $returnFields
         ));
-        
$this->assertEmpty($contribution[wmf_civicrm_get_custom_field_name('campaign')] 
);
+
+        $this->assertArraySubset( $expected, $contribution );
 
         $contribution2 = civicrm_api3('Contribution', 'getsingle', array(
           wmf_civicrm_get_custom_field_name('gateway_txn_id') => 
$message2->getGatewayTxnId(),
-          'return' => array(wmf_civicrm_get_custom_field_name('Campaign'), 
'total_amount'),
+          'return' => $returnFields
         ));
 
-        $this->assertEquals('Benefactor Gift', 
$contribution2[wmf_civicrm_get_custom_field_name('campaign')] );
-
+        $expected = array(
+          'contact_type' => 'Individual',
+          'sort_name' => 'laast, firrst',
+          'display_name' => 'firrst laast',
+          'first_name' => 'firrst',
+          'last_name' => 'laast',
+          'currency' => 'USD',
+          'total_amount' => '2857.02',
+          'fee_amount' => '0.00',
+          'net_amount' => '2857.02',
+          'trxn_id' => 'GLOBALCOLLECT ' . $message2->getGatewayTxnId(),
+          'contribution_source' => 'PLN 952.34',
+          'financial_type' => 'Cash',
+          'contribution_status' => 'Completed',
+          'payment_instrument' => 'Credit Card: Visa',
+          $campaignField => 'Benefactor Gift',
+        );
+        $this->assertArraySubset( $expected, $contribution2 );
         $this->assertNotEquals( $contribution['contact_id'], 
$contribution2['contact_id'] );
     }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4d595f751866b3eb135d421ac21018b30a998d14
Gerrit-PatchSet: 7
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: Cdentinger <[email protected]>
Gerrit-Reviewer: Eileen <[email protected]>
Gerrit-Reviewer: Ejegg <[email protected]>
Gerrit-Reviewer: XenoRyet <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to