Ejegg has uploaded a new change for review. https://gerrit.wikimedia.org/r/199185
Change subject: Merge branch 'master' into deployment ...................................................................... Merge branch 'master' into deployment 0e223db Update Drupal submodule to 7.35 09f9566 JP Morgan: don't allow empty rows; update filename detection 96da4e3 ci-settings: Use BUILD_TAG instead of JOB_NAME+JOB_ID 34e8cfc Merge "Add JSHint configuration" 5f3c2f6 Merge "Move remaining contrib modules into new home" 54e2cce Remove vendor submodule from master branch 7c8cf02 Add JSHint configuration ed1aa95 Move remaining contrib modules into new home 8f52686 Fix watchdog() call params 890a966 Mark test as skipped directly 59af9b3 Mock exchange rates during testing 7019af2 split -> explode bb2de78 Handle dates more carefully in recurring messages 70d92ee Correct mysql client machine name 1d803cd Download stuff before running it. 1310dc2 Move integration scripts into this repo 0f62229 Cache some mailing details 06d4dd5 Require phpunit as a development dependency Change-Id: I0556ce6dcf78b9a563d3ae7a6f700a8eefd05600 --- D sites/all/modules/queue2civicrm/tests/phpunit/ProcessMessageTest.php D sites/all/modules/wmf_civicrm/tests/phpunit/RecurringTest.php D sites/all/modules/wmf_common/tests/includes/BaseWmfDrupalPhpUnitTestCase.php 3 files changed, 0 insertions(+), 271 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm refs/changes/85/199185/1 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 6ef19a1..0000000 --- a/sites/all/modules/queue2civicrm/tests/phpunit/ProcessMessageTest.php +++ /dev/null @@ -1,156 +0,0 @@ -<<<<<<< HEAD (f8fb0f Merge branch 'master' into deployment) -======= -<?php - -class ProcessMessageTest extends BaseWmfDrupalPhpUnitTestCase { - public static function getInfo() { - return array( - 'name' => 'Process Message', - 'group' => 'Pipeline', - 'description' => 'Push messages through the queue intake functions.', - ); - } - - /** - * 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 ); - - queue2civicrm_import( $message ); - queue2civicrm_import( $message2 ); - - $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'] ); - } - - 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 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 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 ); - - queue2civicrm_import( $donation_message ); - $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 MISSING_PREDECESSOR - */ - public function testRefundNoPredecessor() { - $refund_message = new RefundMessage(); - - refund_import( $refund_message ); - } - - /** - * @expectedException WmfException - * @expectedExceptionCode INVALID_MESSAGE - */ - public function testRefundMismatched() { - $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' ), - ) ); - - queue2civicrm_import( $donation_message ); - $contributions = wmf_civicrm_get_contributions_from_gateway_id( $donation_message->getGateway(), $donation_message->getGatewayTxnId() ); - $this->assertEquals( 1, count( $contributions ) ); - - refund_import( $refund_message ); - } -} ->>>>>>> BRANCH (0e223d Update Drupal submodule to 7.35) 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 278b85b..0000000 --- a/sites/all/modules/wmf_civicrm/tests/phpunit/RecurringTest.php +++ /dev/null @@ -1,98 +0,0 @@ -<<<<<<< HEAD (f8fb0f Merge branch 'master' into deployment) -======= -<?php - -class RecurringTest extends BaseWmfDrupalPhpUnitTestCase { - public static function getInfo() { - return array( - 'name' => 'Recurring', - 'group' => 'Pipeline', - 'description' => 'Checks for recurring functionality', - ); - } - - public function setUp() { - parent::setUp(); - civicrm_initialize(); - } - - /** - * Test next_sched_contribution calculation - * - * @dataProvider nextSchedProvider - */ - public function testNextScheduled( $now, $cycle_day, $expected_next_sched ) { - if ( defined( 'HHVM_VERSION' ) ) { - $this->markTestSkipped( 'Running under HHVM, skipping known failure' ); - } - - $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' ), - ); - } - - public function testGetGatewaySubscription() { - // TODO: fixtures - $result = civicrm_api3( 'Contact', 'create', array( - 'first_name' => 'Testes', - 'contact_type' => 'Individual', - ) ); - $this->contact_id = $result['id']; - - $subscription_id_1 = 'SUB_FOO-' . mt_rand(); - $recur_values = array( - 'contact_id' => $this->contact_id, - 'amount' => '1.21', - '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 {$subscription_id_1}", - ); - $result = civicrm_api3( 'ContributionRecur', 'create', $recur_values ); - - $record = wmf_civicrm_get_gateway_subscription( 'TESTGATEWAY', $subscription_id_1 ); - - $this->assertTrue( is_object( $record ), - 'Will match on full unique subscription ID' ); - $this->assertEquals( $recur_values['trxn_id'], $record->trxn_id ); - - $subscription_id_2 = 'SUB_FOO-' . mt_rand(); - $recur_values['trxn_id'] = $subscription_id_2; - $result = civicrm_api3( 'ContributionRecur', 'create', $recur_values ); - - $record = wmf_civicrm_get_gateway_subscription( 'TESTGATEWAY', $subscription_id_2 ); - - $this->assertTrue( is_object( $record ), - 'Will match raw subscription ID' ); - $this->assertEquals( $recur_values['trxn_id'], $record->trxn_id ); - } -} ->>>>>>> BRANCH (0e223d Update Drupal submodule to 7.35) 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 a34a20f..0000000 --- a/sites/all/modules/wmf_common/tests/includes/BaseWmfDrupalPhpUnitTestCase.php +++ /dev/null @@ -1,17 +0,0 @@ -<<<<<<< HEAD (f8fb0f Merge branch 'master' into deployment) -======= -<?php - -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 $_exchange_rate_cache; - $_exchange_rate_cache = array(); - } -} ->>>>>>> BRANCH (0e223d Update Drupal submodule to 7.35) -- To view, visit https://gerrit.wikimedia.org/r/199185 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0556ce6dcf78b9a563d3ae7a6f700a8eefd05600 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