Ejegg has uploaded a new change for review. https://gerrit.wikimedia.org/r/176039
Change subject: Merge branch 'master' into deployment ...................................................................... Merge branch 'master' into deployment a0f2acd Nuke standalone_globalcollect_adapter_path use in test ae9cd24 Delete obsolete require_once lines 2f20fef Test and fix wmf_donor contribution hook 039d766 WMF LYBUNT uses wmf_donor instead of silverpop 61da273 Add is_YYYY_donor and latest donation to wmf_donor Change-Id: I9fad86ebb5334826104470dbccaa7fc4fb597600 --- D sites/all/modules/recurring_globalcollect/tests/RecurringGlobalcollectTest.php D sites/all/modules/wmf_civicrm/tests/phpunit/ImportMessageTest.php 2 files changed, 0 insertions(+), 310 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm refs/changes/39/176039/1 diff --git a/sites/all/modules/recurring_globalcollect/tests/RecurringGlobalcollectTest.php b/sites/all/modules/recurring_globalcollect/tests/RecurringGlobalcollectTest.php deleted file mode 100644 index a21062e..0000000 --- a/sites/all/modules/recurring_globalcollect/tests/RecurringGlobalcollectTest.php +++ /dev/null @@ -1,66 +0,0 @@ -<<<<<<< HEAD (e13cae Merge branch 'master' into deployment) -======= -<?php - -class RecurringGlobalcollectTest extends BaseWmfDrupalPhpUnitTestCase { - function setUp() { - parent::setUp(); - civicrm_initialize(); - - $this->subscription_id = 'SUB-FOO-' . mt_rand(); - $this->amount = '1.12'; - - $this->contributions = array(); - - $result = civicrm_api3( 'Contact', 'create', array( - 'first_name' => 'Testes', - 'contact_type' => 'Individual', - ) ); - $this->contact_id = $result['id']; - - $result = civicrm_api3( 'ContributionRecur', 'create', array( - 'contact_id' => $this->contact_id, - 'amount' => $this->amount, - 'frequency_interval' => 1, - 'frequency_unit' => 'month', - 'next_sched_contribution' => wmf_common_date_unix_to_civicrm(strtotime('+1 month')), - 'installments' => 0, - 'processor_id' => 1, - 'currency' => 'USD', - 'trxn_id' => "RECURRING TESTGATEWAY {$this->subscription_id}", - ) ); - $this->contribution_recur_id = $result['id']; - - $result = civicrm_api3( 'Contribution', 'create', array( - 'contact_id' => $this->contact_id, - 'contribution_recur_id' => $this->contribution_recur_id, - 'currency' => 'USD', - 'total_amount' => $this->amount, - 'contribution_type' => 'Cash', - 'payment_instrument' => 'Credit Card', - 'trxn_id' => 'RECURRING GLOBALCOLLECT STUB_ORIG_CONTRIB-' . mt_rand(), - ) ); - $this->contributions[] = $result['id']; - wmf_civicrm_insert_contribution_tracking( '..rcc', 'civicrm', wmf_common_date_unix_to_sql( strtotime( 'now' ) ), $result['id'] ); - } - - function testCharge() { - $result = recurring_globalcollect_charge( $this->contribution_recur_id ); - $this->assertEquals( 'completed', $result['status'] ); - - $result = civicrm_api3( 'Contribution', 'get', array( - 'contact_id' => $this->contact_id, - ) ); - $this->assertEquals( 2, count( $result['values'] ) ); - foreach ( $result['values'] as $contribution ) { - if ( $contribution['id'] == $this->contributions[0] ) { - // Skip assertions on the synthetic original contribution - continue; - } - - $this->assertEquals( 1, - preg_match( "/^RECURRING GLOBALCOLLECT {$this->subscription_id}-2\$/", $contribution['trxn_id'] ) ); - } - } -} ->>>>>>> BRANCH (a0f2ac Nuke standalone_globalcollect_adapter_path use in test) diff --git a/sites/all/modules/wmf_civicrm/tests/phpunit/ImportMessageTest.php b/sites/all/modules/wmf_civicrm/tests/phpunit/ImportMessageTest.php deleted file mode 100644 index 9f3b777..0000000 --- a/sites/all/modules/wmf_civicrm/tests/phpunit/ImportMessageTest.php +++ /dev/null @@ -1,244 +0,0 @@ -<<<<<<< HEAD (e13cae Merge branch 'master' into deployment) -======= -<?php - -class ImportMessageTest extends BaseWmfDrupalPhpUnitTestCase { - public static function getInfo() { - return array( - 'name' => 'Import Message', - 'group' => 'Pipeline', - 'description' => 'Attempt contribution message import.', - ); - } - - public function setUp() { - parent::setUp(); - - $api = civicrm_api_classapi(); - - // TODO: clean up the fixtures - $contact_params = array( - 'contact_type' => 'Individual', - 'first_name' => 'Test', - 'last_name' => 'Es', - - 'version' => 3, - ); - $api->Contact->Create( $contact_params ); - $this->contact_id = $api->id; - - $this->recur_amount = '1.23'; - - $contribution_params = array( - 'contact_id' => $this->contact_id, - 'amount' => $this->recur_amount, - 'currency' => 'USD', - 'frequency_unit' => 'month', - 'frequency_interval' => '1', - 'installments' => '0', - 'start_date' => wmf_common_date_unix_to_civicrm( time() ), - 'create_date' => wmf_common_date_unix_to_civicrm( time() ), - 'cancel_date' => null, - 'processor_id' => 1, - 'cycle_day' => '1', - 'next_sched_contribution' => null, - 'trxn_id' => 'RECURRING TEST_GATEWAY 123-1 ' . time(), - - 'version' => 3, - ); - $api->ContributionRecur->Create( $contribution_params ); - $this->contribution_recur_id = $api->id; - } - - /** - * @XXX doesn't stupid work cos of member vars: dataProvider messageProvider - */ - public function testMessageInsert() { - foreach ( $this->messageProvider() as $test ) { - list( $msg, $expected_contribution ) = $test; - - // FIXME - $this->run_random_id = mt_rand(); - $msg['gateway_txn_id'] = $this->run_random_id; - - $contribution = wmf_civicrm_contribution_message_import( $msg ); - - // Synthesize trxn_id so it matches the random id we just used - $expected_transaction = new WmfTransaction(); - $expected_transaction->gateway = $msg['gateway']; - $expected_transaction->gateway_txn_id = $msg['gateway_txn_id']; - $expected_transaction->recurring = $msg['recurring']; - $expected_transaction->recur_sequence = ( isset( $msg['effort_id'] ) ? $msg['effort_id'] : null ); - $expected_contribution['trxn_id'] = $expected_transaction->get_unique_id(); - $this->stripTrxnIdTimestamp( $expected_contribution ); - - $this->stripUniques( $contribution ); - - // Strip contact_id if we are have no expectation - if ( empty( $expected_contribution['contact_id'] ) ) { - unset( $contribution['contact_id'] ); - } - - $this->assertEquals( $expected_contribution, $contribution ); - } - } - - /** - * Make sure we import 'Do Not Solicit' values to the wmf_donor table - */ - public function testImportDoNotSolicit() { - $msg = array( - 'email' => 'nob...@wikimedia.org', - 'gross' => '1.23', - 'currency' => 'USD', - 'payment_method' => 'cc', - 'gateway' => 'test_gateway', - 'do_not_solicit' => 'Y', - 'gateway_txn_id' => mt_rand(), - ); - $contribution = wmf_civicrm_contribution_message_import( $msg ); - $donor_fields = wmf_civicrm_contribution_get_custom_values( - $contribution['contact_id'], - array( 'do_not_solicit' ), - 'wmf_donor' - ); - $this->assertEquals( '1', $donor_fields['do_not_solicit'] ); - } - - /** - * Check that wmf_donor fields are updated correctly - */ - public function testImportWmfDonor() { - $msg = array( - 'email' => 'nobo...@wikimedia.org', - 'gross' => '7.55', - 'currency' => 'USD', - 'payment_method' => 'cc', - 'gateway' => 'test_gateway', - 'date' => '2014-07-02', - 'gateway_txn_id' => mt_rand(), - ); - $contribution = wmf_civicrm_contribution_message_import( $msg ); - $donor_fields = wmf_civicrm_contribution_get_custom_values( - $contribution['contact_id'], - array( - 'is_2014_donor', - 'is_2013_donor', - 'last_donation_date', - 'last_donation_usd', - 'lifetime_usd_total', - ), - 'wmf_donor' - ); - $this->assertEquals( '1', $donor_fields['is_2014_donor'] ); - $this->assertEquals( '0', $donor_fields['is_2013_donor'] ); - $this->assertEquals( '2014-07-02', substr( $donor_fields['last_donation_date'], 0, 10 ) ); - $this->assertEquals( '7.55', $donor_fields['last_donation_usd'] ); - $this->assertEquals( '7.55', $donor_fields['lifetime_usd_total'] ); - } - - /** - * Remove unique stuff which cannot be expected - */ - function stripUniques( &$contribution ) { - $isNumber = array( - 'id', - 'receive_date', - ); - foreach ( $isNumber as $field ) { - $this->assertGreaterThan( 0, $contribution[$field] ); - unset( $contribution[$field] ); - } - - $this->stripTrxnIdTimestamp( $contribution ); - } - - function stripTrxnIdTimestamp( &$contribution ) { - $parts = explode( ' ', $contribution['trxn_id'] ); - array_pop( $parts ); - $contribution['trxn_id'] = implode( ' ', $parts ); - } - - public function messageProvider() { - return array( - array( - // Normal contribution - array( - 'email' => 'nob...@wikimedia.org', - 'gross' => '1.23', - 'currency' => 'USD', - 'payment_method' => 'cc', - 'gateway' => 'test_gateway', - ), - array( - 'contribution_type_id' => '5', - 'contribution_page_id' => '', - 'payment_instrument_id' => '1', - 'non_deductible_amount' => '', - 'total_amount' => '1.23', - 'fee_amount' => '0', - 'net_amount' => '1.23', - 'invoice_id' => '', - 'currency' => 'USD', - 'cancel_date' => '', - 'cancel_reason' => '', - 'receipt_date' => '', - 'thankyou_date' => '', - 'source' => 'USD 1.23', - 'amount_level' => '', - 'contribution_recur_id' => '', - 'honor_contact_id' => '', - 'is_test' => '', - 'is_pay_later' => '', - 'contribution_status_id' => '', - 'honor_type_id' => '', - 'address_id' => '', - 'check_number' => 'null', - 'campaign_id' => '', - ), - ), - - // Recurring contribution - array( - array( - 'email' => 'nob...@wikimedia.org', - 'gross' => $this->recur_amount, - 'currency' => 'USD', - 'payment_method' => 'cc', - 'gateway' => 'test_gateway', - 'contact_id' => $this->contact_id, - 'contribution_recur_id' => $this->contribution_recur_id, - 'effort_id' => 2, - ), - array( - 'contact_id' => strval( $this->contact_id ), - 'contribution_type_id' => '5', - 'contribution_page_id' => '', - 'payment_instrument_id' => '1', - 'non_deductible_amount' => '', - 'total_amount' => $this->recur_amount, - 'fee_amount' => '0', - 'net_amount' => $this->recur_amount, - 'invoice_id' => '', - 'currency' => 'USD', - 'cancel_date' => '', - 'cancel_reason' => '', - 'receipt_date' => '', - 'thankyou_date' => '', - 'source' => 'USD ' . $this->recur_amount, - 'amount_level' => '', - 'contribution_recur_id' => strval( $this->contribution_recur_id ), - 'honor_contact_id' => '', - 'is_test' => '', - 'is_pay_later' => '', - 'contribution_status_id' => '', - 'honor_type_id' => '', - 'address_id' => '', - 'check_number' => 'null', - 'campaign_id' => '', - ), - ), - ); - } -} ->>>>>>> BRANCH (a0f2ac Nuke standalone_globalcollect_adapter_path use in test) -- To view, visit https://gerrit.wikimedia.org/r/176039 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9fad86ebb5334826104470dbccaa7fc4fb597600 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