Awight has submitted this change and it was merged. Change subject: Merge remote-tracking branch 'origin/master' into deployment ......................................................................
Merge remote-tracking branch 'origin/master' into deployment Conflicts: tests... Change-Id: I21b635f308ae51816e7470578e8f8be818e1e068 --- D sites/all/modules/offline2civicrm/tests/AzlChecksFileTest.php D sites/all/modules/offline2civicrm/tests/JpMorganFileTest.php D sites/all/modules/offline2civicrm/tests/PayPalChecksFileTest.php D sites/all/modules/offline2civicrm/tests/data/jpmorgan.csv D sites/all/modules/offline2civicrm/tests/includes/AzlChecksFileProbe.php D sites/all/modules/offline2civicrm/tests/includes/JpMorganFileProbe.php D sites/all/modules/offline2civicrm/tests/includes/PayPalChecksFileProbe.php D sites/all/modules/queue2civicrm/tests/simpletest/GlobalcollectRecurring.test D sites/all/modules/queue2civicrm/tests/simpletest/PaypalRecurring.test D sites/all/modules/queue2civicrm/tests/simpletest/queue2civicrm_tests.info D sites/all/modules/recurring_globalcollect/tests/RecurringGlobalcollectTest.php D sites/all/modules/recurring_globalcollect/tests/includes/globalcollect.adapter.php D sites/all/modules/wmf_civicrm/tests/phpunit/ImportMessageTest.php D sites/all/modules/wmf_civicrm/tests/phpunit/RecurringTest.php D sites/all/modules/wmf_common/tests/phpunit/WmfTransactionTest.php D sites/all/modules/wmf_communication/tests/phpunit/MediaWikiMessagesTest.php D sites/all/modules/wmf_communication/tests/phpunit/TranslationTest.php 17 files changed, 0 insertions(+), 1,071 deletions(-) Approvals: Awight: Looks good to me, approved diff --git a/sites/all/modules/offline2civicrm/tests/AzlChecksFileTest.php b/sites/all/modules/offline2civicrm/tests/AzlChecksFileTest.php deleted file mode 100644 index fb6a650..0000000 --- a/sites/all/modules/offline2civicrm/tests/AzlChecksFileTest.php +++ /dev/null @@ -1,133 +0,0 @@ -<?php - -class AzlChecksFileTest extends BaseWmfDrupalPhpUnitTestCase { - function setUp() { - parent::setUp(); - - require_once __DIR__ . "/includes/AzlChecksFileProbe.php"; - } - - function testParseRow_Individual() { - $data = array( - 'Batch' => '1234', - 'Contribution Type' => 'Arizona Lockbox', - 'Total Amount' => '50', - 'Source' => 'USD 50.00', - 'Postmark Date' => '', - 'Received Date' => '4/1/14', - 'Payment Instrument' => 'Check', - 'Check Number' => '2020', - 'Restrictions' => 'Unrestricted - General', - 'Gift Source' => 'Community Gift', - 'Direct Mail Appeal' => 'White Mail', - 'Prefix' => 'Mrs.', - 'First Name' => 'Sub', - 'Last Name' => 'Tell', - 'Suffix' => '', - 'Street Address' => '1000 Markdown Markov', - 'Additional Address 1' => '', - 'Additional Address 2' => '', - 'City' => 'Best St. Louis', - 'State' => 'MA', - 'Postal Code' => '2468', - 'Country' => '', - 'Phone' => '(123) 456-0000', - 'Email' => '', - 'Thank You Letter Date' => '5/1/14', - 'AC Flag' => 'Y', - ); - $expected_normal = array( - 'check_number' => '2020', - 'city' => 'Best St. Louis', - 'contact_source' => 'check', - 'contact_type' => 'Individual', - 'contribution_source' => 'USD 50.00', - 'country' => 'US', - 'currency' => 'USD', - 'date' => 1396335600, - 'direct_mail_appeal' => 'White Mail', - 'email' => 'nob...@wikimedia.org', - 'first_name' => 'Sub', - 'gateway' => 'arizonalockbox', - 'gateway_txn_id' => 'e59ed825ea04516fb2abf1c130d47525', - 'gift_source' => 'Community Gift', - 'gross' => '50.00', - 'import_batch_number' => '1234', - 'last_name' => 'Tell', - 'original_currency' => 'USD', - 'original_gross' => '50.00', - 'payment_method' => 'Check', - 'postal_code' => '02468', - 'raw_contribution_type' => 'Arizona Lockbox', - 'restrictions' => 'Unrestricted - General', - 'state_province' => 'MA', - 'street_address' => '1000 Markdown Markov', - 'thankyou_date' => 1398927600, - ); - - $importer = new AzlChecksFileProbe( "null URI" ); - $output = $importer->_parseRow( $data ); - - $this->assertEquals( $expected_normal, $output ); - } - - function testParseRow_Organization() { - $data = array( - 'Batch' => '1235', - 'Contribution Type' => 'Arizona Lockbox', - 'Total Amount' => '51', - 'Source' => 'USD 51.00', - 'Postmark Date' => '', - 'Received Date' => '4/1/14', - 'Payment Instrument' => 'Check', - 'Check Number' => '202000001', - 'Restrictions' => 'Restricted-Foundation', - 'Gift Source' => 'Foundation Gift', - 'Direct Mail Appeal' => 'White Mail', - 'Organization Name' => 'One Pacific Entitlement', - 'Street Address' => '1000 Markdown Markov', - 'Additional Address 1' => '', - 'Additional Address 2' => '', - 'City' => 'Best St. Louis', - 'State' => 'MA', - 'Postal Code' => '123-LAX', - 'Country' => 'FR', - 'Phone' => '+357 (123) 456-0000', - 'Email' => '', - 'Thank You Letter Date' => '5/1/14', - 'AC Flag' => '', - ); - $expected_normal = array( - 'check_number' => '202000001', - 'city' => 'Best St. Louis', - 'contact_source' => 'check', - 'contact_type' => 'Organization', - 'contribution_source' => 'USD 51.00', - 'country' => 'FR', - 'currency' => 'USD', - 'date' => 1396335600, - 'direct_mail_appeal' => 'White Mail', - 'email' => 'nob...@wikimedia.org', - 'gateway' => 'arizonalockbox', - 'gateway_txn_id' => '6dbb8d844c7509076e2a275fb76d0130', - 'gift_source' => 'Foundation Gift', - 'gross' => 51.00, - 'import_batch_number' => '1235', - 'organization_name' => 'One Pacific Entitlement', - 'original_currency' => 'USD', - 'original_gross' => 51.00, - 'payment_method' => 'Check', - 'postal_code' => '123-LAX', - 'raw_contribution_type' => 'Arizona Lockbox', - 'restrictions' => 'Restricted-Foundation', - 'state_province' => 'MA', - 'street_address' => '1000 Markdown Markov', - 'thankyou_date' => 1398927600, - ); - - $importer = new AzlChecksFileProbe( "null URI" ); - $output = $importer->_parseRow( $data ); - - $this->assertEquals( $expected_normal, $output ); - } -} diff --git a/sites/all/modules/offline2civicrm/tests/JpMorganFileTest.php b/sites/all/modules/offline2civicrm/tests/JpMorganFileTest.php deleted file mode 100644 index 23c032f..0000000 --- a/sites/all/modules/offline2civicrm/tests/JpMorganFileTest.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php - -class JpMorganFileTest extends BaseWmfDrupalPhpUnitTestCase { - function setUp() { - parent::setUp(); - - require_once __DIR__ . "/includes/JpMorganFileProbe.php"; - } - - function testParseRow() { - $data = array( - 'ACCOUNT NAME' => 'Testes EUR_Public', - 'CURRENCY' => 'EUR', - 'REFERENCE' => 'UNAVAILABLE', - 'Bank Ref Number' => '1234TEST', - 'TRANSACTION DATE' => '04/01/2000', - 'TRANSACTION TYPE' => 'FOO CREDIT RECEIVED', - 'VALUE DATE' => '04/02/2000', - 'CREDITS' => '5.50', - ); - $expected_normal = array( - 'contact_type' => 'Individual', - 'date' => 954576000, - 'direct_mail_appeal' => 'White Mail', - 'email' => 'nob...@wikimedia.org', - 'gateway_account' => 'Testes EUR_Public', - 'gateway' => 'jpmorgan', - 'gateway_txn_id' => '1234TEST', - 'gift_source' => 'Community Gift', - //'gross' => 7.1874 - 'no_thank_you' => 'No Contact Details', - 'original_currency' => 'EUR', - 'original_gross' => '5.50', - 'payment_instrument' => 'JP Morgan EUR', - 'restrictions' => 'Unrestricted - General', - 'settlement_date' => 954662400, - ); - - $importer = new JpMorganFileProbe( "no URI" ); - $output = $importer->_parseRow( $data ); - - // FIXME: exchange rate conversion cannot be mocked yet, so just make sure it is present - $this->assertTrue( $output['gross'] > 0 ); - unset( $output['gross'] ); - - $this->assertEquals( $expected_normal, $output ); - } - - function testImport() { - global $user; - //FIXME: move to BaseWmfDrupalPhpUnitTestCase - $user = new stdClass(); - $user->name = "foo_who"; - $user->uid = "321"; - $user->roles = array( DRUPAL_AUTHENTICATED_RID => 'authenticated user' ); - - //FIXME - $_GET['q'] = ''; - //FIXME - civicrm_initialize(); - - $importer = new JpMorganFileProbe( __DIR__ . "/data/jpmorgan.csv" ); - $importer->import(); - - $contribution = wmf_civicrm_get_contributions_from_gateway_id( 'jpmorgan', '1234TEST' ); - $this->assertEquals( 1, count( $contribution ) ); - $this->assertEquals( $contribution[0]['trxn_id'], 'JPMORGAN 1234TEST 1399363947' ); - } -} diff --git a/sites/all/modules/offline2civicrm/tests/PayPalChecksFileTest.php b/sites/all/modules/offline2civicrm/tests/PayPalChecksFileTest.php deleted file mode 100644 index 9459017..0000000 --- a/sites/all/modules/offline2civicrm/tests/PayPalChecksFileTest.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php - -class PayPalChecksFileTest extends BaseWmfDrupalPhpUnitTestCase { - function setUp() { - parent::setUp(); - - require_once __DIR__ . "/includes/PayPalChecksFileProbe.php"; - } - - function testParseRow() { - $data = array( - 'Contribution Type' => 'Cash', - 'Total Amount' => '$10.00', - 'Source' => 'USD 10.00', - 'Received Date' => '1/27/13', - 'Payment Instrument' => 'EFT', - 'Restrictions' => 'Unrestricted - General', - 'Gift Source' => 'Community Gift', - 'Direct Mail Appeal' => 'MissionFish (PayPal)', - 'Prefix' => '', - 'First Name' => 'Diz and', - 'Last Name' => 'Bird', - 'Suffix' => '', - 'Street Address' => '', - 'Additional Address 1' => '', - 'Additional Address 2' => '', - 'City' => '', - 'State' => '', - 'Postal Code' => '', - 'Country' => '', - 'Phone' => '', - 'Email' => '', - 'No Thank You' => 'no reas', - ); - $expected_normal = array( - 'contact_source' => 'check', - 'contact_type' => 'Individual', - 'contribution_source' => 'USD 10.00', - 'country' => 'US', - 'date' => 1359273600, - 'direct_mail_appeal' => 'MissionFish (PayPal)', - 'email' => 'nob...@wikimedia.org', - 'first_name' => 'Diz and', - 'gateway' => 'paypal', - 'gift_source' => 'Community Gift', - 'gross' => '$10.00', - 'last_name' => 'Bird', - 'no_thank_you' => 'no reas', - 'payment_method' => 'EFT', - 'raw_contribution_type' => 'Cash', - 'restrictions' => 'Unrestricted - General', - ); - - $importer = new PayPalChecksFileProbe( "no URI" ); - $output = $importer->_parseRow( $data ); - - $this->assertEquals( $expected_normal, $output ); - } -} diff --git a/sites/all/modules/offline2civicrm/tests/data/jpmorgan.csv b/sites/all/modules/offline2civicrm/tests/data/jpmorgan.csv deleted file mode 100644 index 266cfb2..0000000 --- a/sites/all/modules/offline2civicrm/tests/data/jpmorgan.csv +++ /dev/null @@ -1,2 +0,0 @@ -ACCOUNT NAME,CURRENCY,REFERENCE,Bank Ref Number,TRANSACTION DATE,TRANSACTION TYPE,VALUE DATE,CREDITS -Testes EUR_Public,EUR,UNAVAILABLE,1234TEST,04/01/2000,FOO CREDIT RECEIVED,04/02/2000,5.50 diff --git a/sites/all/modules/offline2civicrm/tests/includes/AzlChecksFileProbe.php b/sites/all/modules/offline2civicrm/tests/includes/AzlChecksFileProbe.php deleted file mode 100644 index c6b18c2..0000000 --- a/sites/all/modules/offline2civicrm/tests/includes/AzlChecksFileProbe.php +++ /dev/null @@ -1,7 +0,0 @@ -<?php - -class AzlChecksFileProbe extends AzlChecksFile { - function _parseRow( $data ) { - return $this->parseRow( $data ); - } -} diff --git a/sites/all/modules/offline2civicrm/tests/includes/JpMorganFileProbe.php b/sites/all/modules/offline2civicrm/tests/includes/JpMorganFileProbe.php deleted file mode 100644 index 7dac60d..0000000 --- a/sites/all/modules/offline2civicrm/tests/includes/JpMorganFileProbe.php +++ /dev/null @@ -1,7 +0,0 @@ -<?php - -class JpMorganFileProbe extends JpMorganFile { - function _parseRow( $data ) { - return $this->parseRow( $data ); - } -} diff --git a/sites/all/modules/offline2civicrm/tests/includes/PayPalChecksFileProbe.php b/sites/all/modules/offline2civicrm/tests/includes/PayPalChecksFileProbe.php deleted file mode 100644 index c35352f..0000000 --- a/sites/all/modules/offline2civicrm/tests/includes/PayPalChecksFileProbe.php +++ /dev/null @@ -1,7 +0,0 @@ -<?php - -class PayPalChecksFileProbe extends PayPalChecksFile { - function _parseRow( $data ) { - return $this->parseRow( $data ); - } -} diff --git a/sites/all/modules/queue2civicrm/tests/simpletest/GlobalcollectRecurring.test b/sites/all/modules/queue2civicrm/tests/simpletest/GlobalcollectRecurring.test deleted file mode 100644 index 20deda9..0000000 --- a/sites/all/modules/queue2civicrm/tests/simpletest/GlobalcollectRecurring.test +++ /dev/null @@ -1,104 +0,0 @@ -<<<<<<< HEAD (724f38 Update drupal submodule to 7.29) -======= -<?php - -require_once __DIR__ . '/BaseTestCase.php'; -require_once __DIR__ . '/../includes/Message.php'; - -class GlobalcollectRecurringTest extends BaseTestCase { - public static function getInfo() { - return array( - 'name' => 'Globalcollect recurring', - 'group' => 'Donations Pipeline', - 'description' => 'Process recurring messages', - ); - } - - public function setUp() { - parent::setUp(); - - $this->subscr_id = mt_rand(); - $this->amount = '2.01'; - - $this->subscription_message = new TransactionMessage( array( - 'txn_type' => 'subscr_signup', - 'subscr_id' => $this->subscr_id, - 'original_gross' => $this->amount, - 'gross' => $this->amount, - 'amount' => $this->amount, - 'frequency_unit' => 'month', - 'frequency_interval' => '1', - 'installments' => '10', - 'create_date' => strtotime( '2000-01-01 00:01:02' ), - 'start_date' => strtotime( '2000-01-01 01:02:03' ), - ) ); - - $this->payment_message = new TransactionMessage( array( - 'txn_type' => 'subscr_payment', - 'subscr_id' => $this->subscr_id, - 'original_gross' => $this->amount, - 'gross' => $this->amount, - 'payment_date' => strtotime( "2000-02-01 01:02:03" ), - ) ); - - recurring_import( $this->subscription_message ); - recurring_import( $this->payment_message ); - } - - public function testUpdateSuccess() { - $recur_record = wmf_civicrm_get_recur_record( $this->subscr_id ); - - _recurring_globalcollect_update_record_success( $recur_record->id ); - - $updated_record = wmf_civicrm_get_recur_record( $this->subscr_id ); - $this->verbose(json_encode($updated_record)); - $this->assertSuperset( get_object_vars( $updated_record ), array( - 'failure_count' => '0', - 'failure_retry_date' => null, - 'contribution_status_id' => (string)civicrm_api_contribution_status('Completed'), - ) ); - } - - public function testUpdateInProgress() { - $recur_record = wmf_civicrm_get_recur_record( $this->subscr_id ); - - _recurring_globalcollect_update_record_in_progress( $recur_record->id ); - - $updated_record = wmf_civicrm_get_recur_record( $this->subscr_id ); - $this->verbose(json_encode($updated_record)); - $this->assertSuperset( get_object_vars( $updated_record ), array( - 'contribution_status_id' => (string)civicrm_api_contribution_status('In Progress'), - ) ); - } - - public function testUpdateFailure() { - $recur_record = wmf_civicrm_get_recur_record( $this->subscr_id ); - - variable_set( 'recurring_globalcollect_failures_before_cancellation', 2 ); - - _recurring_globalcollect_update_record_failure( $recur_record->id ); - - $updated_record = wmf_civicrm_get_recur_record( $this->subscr_id ); - $this->verbose(json_encode($updated_record)); - $this->assertSuperset( get_object_vars( $updated_record ), array( - 'failure_count' => '1', - 'contribution_status_id' => (string)civicrm_api_contribution_status('Failed'), - ) ); - $retry_date = new DateTime( $updated_record->failure_retry_date ); - $now = new DateTime( "now - 1 hour" ); - // Yes, this diff function is backwards - $diff = date_diff( $now, $retry_date ); - $this->assertTrue( $diff->days >= 1 && $diff->invert == 0, - "Retry date was set to a day in the future" ); - - _recurring_globalcollect_update_record_failure( $recur_record->id ); - $cancelled_record = wmf_civicrm_get_recur_record( $this->subscr_id ); - $this->verbose(json_encode($cancelled_record)); - $this->assertSuperset( get_object_vars( $cancelled_record ), array( - 'failure_count' => '2', - 'contribution_status_id' => (string)civicrm_api_contribution_status('Cancelled'), - 'next_sched_contribution' => null, - ) ); - } -} ->>>>>>> BRANCH (3b2802 Merge "fix weak fail on missing initial contribution") diff --git a/sites/all/modules/queue2civicrm/tests/simpletest/PaypalRecurring.test b/sites/all/modules/queue2civicrm/tests/simpletest/PaypalRecurring.test deleted file mode 100644 index a72dee0..0000000 --- a/sites/all/modules/queue2civicrm/tests/simpletest/PaypalRecurring.test +++ /dev/null @@ -1,195 +0,0 @@ -<<<<<<< HEAD (724f38 Update drupal submodule to 7.29) -======= -<?php - -require_once __DIR__ . '/BaseTestCase.php'; -require_once __DIR__ . '/../includes/Message.php'; - -class PaypalRecurringTest extends BaseTestCase { - public static function getInfo() { - return array( - 'name' => 'PayPal recurring', - 'group' => 'Donations Pipeline', - 'description' => 'Process recurring messages', - ); - } - - public function setUp() { - parent::setUp(); - - $this->subscr_id = mt_rand(); - $this->amount = '2.01'; - - $this->subscription_message = new TransactionMessage( array( - 'txn_type' => 'subscr_signup', - 'subscr_id' => $this->subscr_id, - 'original_gross' => $this->amount, - 'gross' => $this->amount, - 'amount' => $this->amount, - 'frequency_unit' => 'month', - 'frequency_interval' => '1', - 'installments' => '10', - 'create_date' => strtotime( '2000-01-01 00:01:02' ), - 'start_date' => strtotime( '2000-01-01 01:02:03' ), - ) ); - - $this->payment_message = new TransactionMessage( array( - 'txn_type' => 'subscr_payment', - 'subscr_id' => $this->subscr_id, - 'original_gross' => $this->amount, - 'gross' => $this->amount, - 'payment_date' => strtotime( "2000-02-01 01:02:03" ), - ) ); - - $this->expire_message = new TransactionMessage( array( - 'txn_type' => 'subscr_eot', - 'subscr_id' => $this->subscr_id, - ) ); - - $this->cancel_message = new TransactionMessage( array( - 'txn_type' => 'subscr_cancel', - 'subscr_id' => $this->subscr_id, - 'cancel_date' => strtotime( '2000-04-01 00:01:02' ), - ) ); - - $this->failed_message = new TransactionMessage( array( - 'txn_type' => 'subscr_failed', - 'subscr_id' => $this->subscr_id, - 'failure_count' => '3', - 'failure_retry_date' => strtotime( '2000-05-01 00:01:02' ), - ) ); - - //TODO: modification messages are not processed currently - - $this->existing_subscr_id = mt_rand(); - - $this->existing_contrib_message_body = array( - 'subscr_id' => $this->existing_subscr_id, - 'payment_date' => wmf_common_date_unix_to_civicrm( time() ), - 'txn_type' => 'subscr_payment', - ); - - $api = civicrm_api_classapi(); - - $api->Contact->Create( array( - 'contact_type' => 'Individual', - 'email' => 'f...@example.com', - 'version' => 3, - ) ); - $this->contact_id = $api->id; - - $api->ContributionRecur->Create( array( - 'contact_id' => $this->contact_id, - 'frequency_interval' => 1, - 'trxn_id' => $this->existing_subscr_id, - 'version' => 3, - ) ); - $this->existing_recur_id = $api->id; - - $api->Contribution->Create( array( - 'contact_id' => $this->contact_id, - 'contribution_type' => 'Cash', - 'contribution_recur_id' => $this->existing_recur_id, - 'total_amount' => '20.01', - 'version' => 3, - ) ); - $this->existing_contribution_id = $api->id; - - $this->ctid = wmf_civicrm_insert_contribution_tracking( 'foo', 'web', time(), $this->existing_contribution_id, true, true ); - } - - public function tearDown() { - $api = civicrm_api_classapi(); - - $api->ContributionRecur->Delete( array( - 'id' => $this->existing_recur_id, - 'version' => 3, - ) ); - - $api->Contribution->Delete( array( - 'id' => $this->existing_contribution_id, - 'version' => 3, - ) ); - - parent::tearDown(); - } - - public function testNormalPayment() { - recurring_import( $this->subscription_message ); - recurring_import( $this->payment_message ); - - $payment_data = $this->payment_message->getBody(); - - $contributions = wmf_civicrm_get_contributions_from_gateway_id( $payment_data['gateway'], $payment_data['gateway_txn_id'] ); - $recur_record = wmf_civicrm_get_recur_record( $this->subscr_id ); - //FIXME: convert to array - - $this->verbose( json_encode( $contributions ) ); - $this->assertSuperset( $contributions, array( - array( - 'original_amount' => $this->amount, - 'contribution_recur_id' => $recur_record->id, - ), - ) ); - - $this->verbose( json_encode( $recur_record ) ); - $this->assertSuperset( get_object_vars( $recur_record ), array( - 'amount' => $this->amount, - 'next_sched_contribution' => '2000-03-01 01:02:03', - 'frequency_interval' => '1', - 'frequency_unit' => 'month', - 'cycle_day' => '1', - 'create_date' => '2000-01-01 00:01:02', - 'start_date' => '2000-01-01 01:02:03', - 'end_date' => null, - 'installments' => '10', - 'trxn_id' => (string)$this->subscr_id, - ) ); - } - - public function testNoSubscription() { - try { - recurring_import( $this->payment_message ); - $this->fail( "should have gotten a RequeueError." ); - } catch ( RequeueError $ex ) { - // good. - } - } - - public function testExpire() { - recurring_import( $this->subscription_message ); - recurring_import( $this->expire_message ); - - $recur_record = wmf_civicrm_get_recur_record( $this->subscr_id ); - $this->assertNotNull( $recur_record->end_date ); - } - - public function testCancel() { - recurring_import( $this->subscription_message ); - recurring_import( $this->cancel_message ); - - $recur_record = wmf_civicrm_get_recur_record( $this->subscr_id ); - $this->assertSuperset( get_object_vars( $recur_record ), array( - 'end_date' => '2000-04-01 00:01:02', - 'cancel_date' => '2000-04-01 00:01:02', - ) ); - } - - public function testFailed() { - recurring_import( $this->subscription_message ); - recurring_import( $this->failed_message ); - - $recur_record = wmf_civicrm_get_recur_record( $this->subscr_id ); - $this->assertSuperset( get_object_vars( $recur_record ), array( - 'failure_count' => '3', - 'failure_retry_date' => '2000-05-01 00:01:02', - ) ); - } - - public function testRecurring_get_contribution_tracking_idFromPrevious() { - $ctid = recurring_get_contribution_tracking_id( $this->existing_contrib_message_body ); - $this->assertEqual( $this->ctid, $ctid, - "Contribution tracking can be looked up from msg.subscr_id" ); - } -} ->>>>>>> BRANCH (3b2802 Merge "fix weak fail on missing initial contribution") diff --git a/sites/all/modules/queue2civicrm/tests/simpletest/queue2civicrm_tests.info b/sites/all/modules/queue2civicrm/tests/simpletest/queue2civicrm_tests.info deleted file mode 100644 index ba472fb..0000000 --- a/sites/all/modules/queue2civicrm/tests/simpletest/queue2civicrm_tests.info +++ /dev/null @@ -1,16 +0,0 @@ -<<<<<<< HEAD (724f38 Update drupal submodule to 7.29) -======= -name = Queue to CiviCRM Tests -description = Tests -core = 7.x -dependencies[] = queue2civicrm -dependencies[] = recurring -dependencies[] = wmf_civicrm -dependencies[] = wmf_refund_qc -dependencies[] = recurring_globalcollect -package = queue2civicrm.simpletest -files[] = PaypalRecurring.test -files[] = GlobalcollectRecurring.test -files[] = refund.test -files[] = txnid.test ->>>>>>> BRANCH (3b2802 Merge "fix weak fail on missing initial contribution") 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 0e7a423..0000000 --- a/sites/all/modules/recurring_globalcollect/tests/RecurringGlobalcollectTest.php +++ /dev/null @@ -1,86 +0,0 @@ -<<<<<<< HEAD (724f38 Update drupal submodule to 7.29) -======= -<?php - -class RecurringGlobalcollectTest extends BaseWmfDrupalPhpUnitTestCase { - function setUp() { - parent::setUp(); - civicrm_initialize(); - - $this->original_standalone_globalcollect_adapter_path = variable_get( 'standalone_globalcollect_adapter_path', null ); - variable_set( 'standalone_globalcollect_adapter_path', __DIR__ . '/includes' ); - - $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' => "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', - ) ); - $this->contributions[] = $result['id']; - } - - function tearDown() { - variable_set( 'standalone_globalcollect_adapter_path', $this->original_standalone_globalcollect_adapter_path ); - - foreach ( $this->contributions as $contribution_id ) { - civicrm_api3( 'Contribution', 'delete', array( - 'id' => $contribution_id, - ) ); - } - civicrm_api3( 'ContributionRecur', 'delete', array( - 'id' => $this->contribution_recur_id, - ) ); - civicrm_api3( 'Contact', 'delete', array( - 'id' => $this->contact_id, - ) ); - parent::tearDown(); - } - - function testCharge() { - $result = civicrm_api3( 'ContributionRecur', 'get', array( - 'id' => $this->contribution_recur_id, - ) ); - $contribution_recur = array_pop( $result['values'] ); - - $result = recurring_globalcollect_charge( $contribution_recur ); - $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] ) { - continue; - } - $this->contributions[] = $contribution['id']; - } - } -} ->>>>>>> BRANCH (3b2802 Merge "fix weak fail on missing initial contribution") diff --git a/sites/all/modules/recurring_globalcollect/tests/includes/globalcollect.adapter.php b/sites/all/modules/recurring_globalcollect/tests/includes/globalcollect.adapter.php deleted file mode 100644 index ad13461..0000000 --- a/sites/all/modules/recurring_globalcollect/tests/includes/globalcollect.adapter.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -/** - * Stub - * - * Should be a proper test double, with expectations. - */ -class GlobalCollectAdapter { - function __construct( $options ) { - } - - function do_transaction( $name ) { - return array( - 'status' => 'completed', - ); - } - - function load_request_data( $data ) { - } -} 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 ccac575..0000000 --- a/sites/all/modules/wmf_civicrm/tests/phpunit/ImportMessageTest.php +++ /dev/null @@ -1,187 +0,0 @@ -<?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 ); - } - } - - /** - * 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' => '', - ), - ), - ); - } -} diff --git a/sites/all/modules/wmf_civicrm/tests/phpunit/RecurringTest.php b/sites/all/modules/wmf_civicrm/tests/phpunit/RecurringTest.php deleted file mode 100644 index a85e668..0000000 --- a/sites/all/modules/wmf_civicrm/tests/phpunit/RecurringTest.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php - -class RecurringTest extends BaseWmfDrupalPhpUnitTestCase { - public static function getInfo() { - return array( - 'name' => 'Recurring', - 'group' => 'Pipeline', - 'description' => 'Checks for recurring functionality', - ); - } - - /** - * Test next_sched_contribution calculation - * - * @dataProvider nextSchedProvider - */ - public function testNextScheduled( $now, $cycle_day, $expected_next_sched ) { - $msg = array( - 'cycle_day' => $cycle_day, - 'frequency_interval' => 1, - ); - $nowstamp = strtotime($now); - $calculated_next_sched = wmf_civicrm_get_next_sched_contribution_date_for_month( $msg, $nowstamp ); - - $this->assertEquals( $expected_next_sched, $calculated_next_sched ); - } - - public function nextSchedProvider() { - return array( - array( '2014-06-01T00:00:00Z', '1', '2014-07-01 00:00:00' ), - array( '2014-06-01T01:00:00Z', '1', '2014-07-01 00:00:00' ), - array( '2014-06-01T02:00:00Z', '1', '2014-07-01 00:00:00' ), - array( '2014-06-01T03:00:00Z', '1', '2014-07-01 00:00:00' ), - array( '2014-06-01T04:00:00Z', '1', '2014-07-01 00:00:00' ), - array( '2014-06-01T05:00:00Z', '1', '2014-07-01 00:00:00' ), - array( '2014-06-01T06:59:00Z', '1', '2014-07-01 00:00:00' ), - array( '2014-06-01T07:00:00Z', '1', '2014-07-01 00:00:00' ), - array( '2014-06-01T07:01:00Z', '1', '2014-07-01 00:00:00' ), - array( '2014-06-01T08:00:00Z', '1', '2014-07-01 00:00:00' ), - array( '2014-06-01T09:00:00Z', '1', '2014-07-01 00:00:00' ), - array( '2014-06-01T13:00:00Z', '1', '2014-07-01 00:00:00' ), - array( '2014-06-01T14:00:00Z', '1', '2014-07-01 00:00:00' ), - array( '2014-06-01T15:00:00Z', '1', '2014-07-01 00:00:00' ), - array( '2014-06-01T16:00:00Z', '1', '2014-07-01 00:00:00' ), - ); - } -} diff --git a/sites/all/modules/wmf_common/tests/phpunit/WmfTransactionTest.php b/sites/all/modules/wmf_common/tests/phpunit/WmfTransactionTest.php deleted file mode 100644 index 02a5bad..0000000 --- a/sites/all/modules/wmf_common/tests/phpunit/WmfTransactionTest.php +++ /dev/null @@ -1,69 +0,0 @@ -<<<<<<< HEAD (724f38 Update drupal submodule to 7.29) -======= -<?php - -class WmfTransactionTestCase extends BaseWmfDrupalPhpUnitTestCase { - public function testParseUniqueId() { - $transaction = WmfTransaction::from_unique_id( "RFD RECURRING GLOBALCOLLECT 1234 432" ); - $this->assertEquals( - $transaction->gateway_txn_id, "1234", - "5-argument form gateway_txn_id is parsed correctly." ); - $this->assertEquals( - true, $transaction->is_refund, - "refund flag parsed" ); - $this->assertEquals( - true, $transaction->is_recurring, - "recurring flag parsed" ); - $this->assertEquals( - "globalcollect", strtolower( $transaction->gateway ), - "gateway is correctly parsed" ); - $this->assertEquals( - "432", $transaction->timestamp, - "timestamp is correctly parsed" ); - $this->assertEquals( - $transaction->get_unique_id(), "RFD RECURRING GLOBALCOLLECT 1234 432", - "5-argument form is not mangled" ); - - $transaction = WmfTransaction::from_unique_id( "RFD GLOBALCOLLECT 1234 432" ); - $this->assertEquals( - $transaction->gateway_txn_id, "1234", - "4-argument form gateway_txn_id is parsed correctly." ); - $this->assertEquals( - true, $transaction->is_refund, - "refund flag parsed" ); - $this->assertEquals( - $transaction->get_unique_id(), "RFD GLOBALCOLLECT 1234 432", - "4-argument form is not mangled" ); - - $transaction = WmfTransaction::from_unique_id( "GLOBALCOLLECT 1234x 432" ); - $this->assertEquals( - $transaction->gateway_txn_id, "1234x", - "3-argument form gateway_txn_id is parsed correctly." ); - $this->assertEquals( - $transaction->get_unique_id(), strtoupper( "GLOBALCOLLECT 1234x 432" ), - "3-argument form is not mangled" ); - - $transaction = WmfTransaction::from_unique_id( "GLOBALCOLLECT 1234" ); - $this->assertEquals( - $transaction->gateway_txn_id, "1234", - "2-argument form gateway_txn_id is parsed correctly." ); - $this->assertEquals( 1, - preg_match( "/GLOBALCOLLECT 1234 [0-9]+/", $transaction->get_unique_id() ), - "2-argument form is given a timestamp" ); - } - - public function testParseMessage() { - $msg = array( - 'gateway' => "globalcollect", - 'gateway_txn_id' => "1234", - ); - $transaction = WmfTransaction::from_message( $msg ); - $this->assertEquals( - "1234", $transaction->gateway_txn_id, - "parsed message gateway_txn_id is correct" ); - $this->assertEquals( 1, - preg_match( "/GLOBALCOLLECT 1234 [0-9]+/", $transaction->get_unique_id() ), - "parsed message is given a timestamp" ); - } -} ->>>>>>> BRANCH (3b2802 Merge "fix weak fail on missing initial contribution") diff --git a/sites/all/modules/wmf_communication/tests/phpunit/MediaWikiMessagesTest.php b/sites/all/modules/wmf_communication/tests/phpunit/MediaWikiMessagesTest.php deleted file mode 100644 index 889dd8f..0000000 --- a/sites/all/modules/wmf_communication/tests/phpunit/MediaWikiMessagesTest.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php -namespace wmf_communication; - -use \BaseWmfDrupalPhpUnitTestCase; - -class MediaWikiMessagesTest extends BaseWmfDrupalPhpUnitTestCase { - function setUp() { - parent::setUp(); - - $this->msgs = MediaWikiMessages::getInstance(); - } - - function testGetMsg_en() { - $str = $this->msgs->getMsg( 'donate_interface-submit-button', 'en' ); - $this->assertTrue( !empty( $str ) ); - } - - function testGetMsg_other() { - $enStr = $this->msgs->getMsg( 'donate_interface-submit-button', 'en' ); - - $str = $this->msgs->getMsg( 'donate_interface-submit-button', 'fr' ); - $this->assertTrue( !empty( $str ) ); - $this->assertNotEquals( $enStr, $str ); - } - - function testMsgExists() { - $this->assertTrue( $this->msgs->msgExists( 'donate_interface-submit-button', 'en' ) ); - $this->assertTrue( $this->msgs->msgExists( 'donate_interface-submit-button', 'fr' ) ); - } - - function testLanguageList() { - $languages = $this->msgs->languageList(); - $this->assertTrue( count($languages) > 3 ); - $this->assertTrue( in_array( 'en', $languages ) ); - $this->assertTrue( in_array( 'fr', $languages ) ); - } -} diff --git a/sites/all/modules/wmf_communication/tests/phpunit/TranslationTest.php b/sites/all/modules/wmf_communication/tests/phpunit/TranslationTest.php deleted file mode 100644 index 3ff0c92..0000000 --- a/sites/all/modules/wmf_communication/tests/phpunit/TranslationTest.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php -namespace wmf_communication; - -use \BaseWmfDrupalPhpUnitTestCase; - -class TranslationTest extends BaseWmfDrupalPhpUnitTestCase { - protected $msgKey = 'donate_interface-submit-button'; - - function testReplaceMessages() { - $smallStr = MediaWikiMessages::getInstance()->getMsg( $this->msgKey, 'fr' ); - $fullStr = Translation::replace_messages( "Viva %{$this->msgKey}%", 'fr' ); - - $this->assertEquals( "Viva $smallStr", $fullStr ); - } - - function testNextFallback() { - $langcode = Translation::next_fallback( 'fr-US' ); - $this->assertEquals( 'fr', $langcode ); - } - - function testGetTranslatedMessage() { - $str = Translation::get_translated_message( $this->msgKey, 'fr-YY' ); - $directlyTranslated = MediaWikiMessages::getInstance()->getMsg( $this->msgKey, 'fr' ); - $this->assertEquals( $directlyTranslated, $str ); - } -} -- To view, visit https://gerrit.wikimedia.org/r/150043 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I21b635f308ae51816e7470578e8f8be818e1e068 Gerrit-PatchSet: 1 Gerrit-Project: wikimedia/fundraising/crm Gerrit-Branch: deployment Gerrit-Owner: Awight <awi...@wikimedia.org> Gerrit-Reviewer: Awight <awi...@wikimedia.org> Gerrit-Reviewer: Ejegg <eeggles...@wikimedia.org> Gerrit-Reviewer: Katie Horn <kh...@wikimedia.org> Gerrit-Reviewer: Mwalker <mwal...@wikimedia.org> Gerrit-Reviewer: Siebrand <siebr...@kitano.nl> Gerrit-Reviewer: Ssmith <ssm...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits