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
Change-Id: Id70abd01a4cbb401a5a1617bcd223ec7a351bc07
---
D sites/all/modules/queue2civicrm/tests/data/donation.json
D sites/all/modules/queue2civicrm/tests/data/paypal_eot.json
D sites/all/modules/queue2civicrm/tests/data/recurring_payment.json
D sites/all/modules/queue2civicrm/tests/data/recurring_signup.json
D sites/all/modules/queue2civicrm/tests/data/refund.json
D sites/all/modules/queue2civicrm/tests/includes/Message.php
D sites/all/modules/queue2civicrm/tests/phpunit/ProcessMessageTest.php
D sites/all/modules/recurring_globalcollect/tests/RecurringGlobalcollectTest.php
D sites/all/modules/wmf_civicrm/tests/phpunit/NameSplitTest.php
D sites/all/modules/wmf_civicrm/tests/phpunit/RecurringTest.php
D sites/all/modules/wmf_common/tests/phpunit/WmfTransactionTest.php
11 files changed, 0 insertions(+), 758 deletions(-)
Approvals:
Awight: Looks good to me, approved
diff --git a/sites/all/modules/queue2civicrm/tests/data/donation.json
b/sites/all/modules/queue2civicrm/tests/data/donation.json
deleted file mode 100644
index 00728d2..0000000
--- a/sites/all/modules/queue2civicrm/tests/data/donation.json
+++ /dev/null
@@ -1,47 +0,0 @@
-<<<<<<< HEAD (9a63b8 (FR #1845) Assert no unconsumed tokens while rendering
thank)
-=======
-{
- "anonymous": "1",
- "city_2": "cc",
- "city": "cc",
- "comment": "",
- "contribution_tracking_id": "441",
- "country_2": "DE",
- "country": "IL",
- "currency": "PLN",
- "date": 1234567,
- "email": "[email protected]",
- "fee": "0",
- "first_name_2": "b",
- "first_name": "firrst",
- "gateway_account": "default",
- "gateway": "globalcollect",
- "gateway_txn_id": "3611204184",
- "gross": "952.34",
- "language": "en",
- "last_name_2": "w",
- "last_name": "laast",
- "middle_name": "",
- "optout": "1",
- "original_currency": "PLN",
- "original_gross": "952.34",
- "payment_method": "cc",
- "payment_submethod": "visa",
- "postal_code": "11122",
- "postal_code_2": "11122",
- "premium_language": "en",
- "referrer":
"http://payments.local.net/index.php/Special:GlobalCollectGateway?uselang=en&masthead=none&form_name=RapidHtml&text_template=2010/JimmyQuote-green&appeal=JimmyQuote-green&language=ar&ffname=cc_vma&amount=12.34&currency_code=BRL",
- "response": "Original Response Status (pre-SET_PAYMENT): 600",
- "size": "",
- "state_province_2": "AL",
- "state_province": "Haifa",
- "street_address_2": "st 2nd.",
- "street_address": "ss",
- "supplemental_address_1": "",
- "supplemental_address_2": "",
- "user_ip": "127.0.0.2",
- "utm_campaign": "",
- "utm_medium": "",
- "utm_source": "..cc"
-}
->>>>>>> BRANCH (af4497 Comment that HHVM will mess up this code)
diff --git a/sites/all/modules/queue2civicrm/tests/data/paypal_eot.json
b/sites/all/modules/queue2civicrm/tests/data/paypal_eot.json
deleted file mode 100644
index d6aab1b..0000000
--- a/sites/all/modules/queue2civicrm/tests/data/paypal_eot.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "business": "[email protected]",
- "charset": "UTF-8",
- "custom": "21578120",
- "first_name": "Warsaw",
- "ipn_track_id": "a2586200c313f",
- "item_name": "Foo",
- "item_number": "DONATE",
- "last_name": "Nato",
- "mc_currency": "",
- "notify_version": "3.7",
- "payer_email": "[email protected]",
- "payer_id": "XTJGLNXXEG3H8",
- "payer_status": "verified",
- "receiver_email": "[email protected]",
- "residence_country": "US",
- "subscr_id": "S-3MB38092GW5615720",
- "txn_type": "subscr_eot",
- "verify_sign": "Acb5jgF7-dzo0JtZzwmhjYr8lRJsAizy-qiDD5TGaZVGwj583klds2Ov"
-}
diff --git a/sites/all/modules/queue2civicrm/tests/data/recurring_payment.json
b/sites/all/modules/queue2civicrm/tests/data/recurring_payment.json
deleted file mode 100644
index dc9855a..0000000
--- a/sites/all/modules/queue2civicrm/tests/data/recurring_payment.json
+++ /dev/null
@@ -1,43 +0,0 @@
-<<<<<<< HEAD (9a63b8 (FR #1845) Assert no unconsumed tokens while rendering
thank)
-=======
-{
- "address_city": "Edmonton",
- "address_country": "Canada",
- "address_country_code": "CA",
- "address_name": "Gen Russ",
- "address_state": "Alberta",
- "address_status": "confirmed",
- "address_street": "1211122 132 st",
- "address_zip": "T4V 2L2",
- "business": "[email protected]",
- "charset": "UTF-8",
- "custom": "15017277",
- "first_name": "Gen",
- "gateway": "paypal",
- "ipn_track_id": "aab364ce13499",
- "item_name": "Donation to the Wikimedia Foundation",
- "item_number": "DONATE",
- "last_name": "Russ",
- "mc_currency": "CAD",
- "mc_fee": "0.33",
- "mc_gross": "3.00",
- "notify_version": "3.7",
- "payer_email": "[email protected]",
- "payer_id": "24B4Y6BZGNT2C",
- "payer_status": "unverified",
- "payment_date": "15:52:33 Nov 01, 2013 PDT",
- "payment_fee": "",
- "payment_gross": "",
- "payment_status": "Completed",
- "payment_type": "instant",
- "protection_eligibility": "Eligible",
- "receiver_email": "[email protected]",
- "receiver_id": "EZ782AEXJUWU8",
- "recurring": 1,
- "residence_country": "CA",
- "subscr_id": "S-64E67934881J88118",
- "transaction_subject": "15201777",
- "txn_type": "subscr_payment",
- "verify_sign": "AMuUaVWl4LgJrwIOMczIBpnrLrrZAkmsqzN5PHvG6cUBxLoeCb475B8V"
-}
->>>>>>> BRANCH (af4497 Comment that HHVM will mess up this code)
diff --git a/sites/all/modules/queue2civicrm/tests/data/recurring_signup.json
b/sites/all/modules/queue2civicrm/tests/data/recurring_signup.json
deleted file mode 100644
index f1580f3..0000000
--- a/sites/all/modules/queue2civicrm/tests/data/recurring_signup.json
+++ /dev/null
@@ -1,38 +0,0 @@
-<<<<<<< HEAD (9a63b8 (FR #1845) Assert no unconsumed tokens while rendering
thank)
-=======
-{
- "address_city": "Bethel Park",
- "address_country_code": "US",
- "address_country": "United States",
- "address_name": "Gen Russ",
- "address_state": "PA",
- "address_status": "confirmed",
- "address_street": "5109 Lockwood Rd",
- "address_zip": "15110-1232",
- "amount3": "3.00",
- "business": "[email protected]",
- "charset": "UTF-8",
- "custom": "15028173",
- "first_name": "Gen D",
- "gateway": "paypal",
- "ipn_track_id": "38c689188774d",
- "item_name": "Donation to the Wikimedia Foundation",
- "item_number": "DONATE",
- "last_name": "Russ",
- "mc_amount3": "3.00",
- "mc_currency": "CAD",
- "notify_version": "3.7",
- "payer_email": "[email protected]",
- "payer_id": "HK88M82Y7MLZ2",
- "payer_status": "verified",
- "period3": "1 M",
- "reattempt": "1",
- "receiver_email": "[email protected]",
- "recurring": "1",
- "residence_country": "US",
- "subscr_date": "16:07:05 Nov 01, 2013 PDT",
- "subscr_id": "S-1028048X07A26702A",
- "txn_type": "subscr_signup",
- "verify_sign": "A5VSEChOEYwkDv7mgId.m2eXJO5RAhH.qwB5AejTaUrPjcw9JvEAv2S0"
-}
->>>>>>> BRANCH (af4497 Comment that HHVM will mess up this code)
diff --git a/sites/all/modules/queue2civicrm/tests/data/refund.json
b/sites/all/modules/queue2civicrm/tests/data/refund.json
deleted file mode 100644
index 7402d94..0000000
--- a/sites/all/modules/queue2civicrm/tests/data/refund.json
+++ /dev/null
@@ -1,12 +0,0 @@
-<<<<<<< HEAD (9a63b8 (FR #1845) Assert no unconsumed tokens while rendering
thank)
-=======
-{
- "date": 1234567,
- "gateway": "globalcollect",
- "gateway_parent_id": "1234",
- "gateway_refund_id": "1235",
- "gross": "50",
- "gross_currency": "BAA",
- "type": "chargeback"
-}
->>>>>>> BRANCH (af4497 Comment that HHVM will mess up this code)
diff --git a/sites/all/modules/queue2civicrm/tests/includes/Message.php
b/sites/all/modules/queue2civicrm/tests/includes/Message.php
deleted file mode 100644
index f8c2877..0000000
--- a/sites/all/modules/queue2civicrm/tests/includes/Message.php
+++ /dev/null
@@ -1,108 +0,0 @@
-<<<<<<< HEAD (9a63b8 (FR #1845) Assert no unconsumed tokens while rendering
thank)
-=======
-<?php
-
-class Message {
- protected $defaults = array();
-
- public $body;
- public $headers;
-
- protected $data;
-
- function __construct( $values = array() ) {
- $this->data = $this->defaults;
- $this->headers = array();
- $this->set( $values );
- }
-
- function set( $values ) {
- if ( is_array( $values ) ) {
- $this->data = $values + $this->data;
- }
-
- $this->body = json_encode( $this->data );
- }
-
- function setHeaders( $values ) {
- if ( is_array( $values ) ) {
- $this->headers = array_merge( $this->headers, $values );
- }
- }
-
- function getBody() {
- return $this->data;
- }
-
- function getHeaders() {
- return $this->headers;
- }
-
- function loadDefaults( $name ) {
- if ( !$this->defaults ) {
- $path = __DIR__ . "/../data/{$name}.json";
- $this->defaults = json_decode( file_get_contents( $path ), true );
- }
- }
-}
-
-class TransactionMessage extends Message {
- protected $txn_id_key = 'gateway_txn_id';
-
- function __construct( $values = array() ) {
- $this->loadDefaults( "donation" );
-
- parent::__construct( array(
- $this->txn_id_key => mt_rand(),
- 'order_id' => mt_rand(),
- ) + $values );
-
- $this->setHeaders( array(
- "persistent" => 'true',
- // FIXME: this might indicate a key error in our application code.
- "correlation-id" =>
"{$this->data['gateway']}-{$this->data[$this->txn_id_key]}",
- "JMSCorrelationID" =>
"{$this->data['gateway']}-{$this->data[$this->txn_id_key]}",
- ) );
- }
-
- function getGateway() {
- return $this->data['gateway'];
- }
-
- function getGatewayTxnId() {
- return $this->data[$this->txn_id_key];
- }
-
- function get( $key ) {
- return $this->data[$key];
- }
-}
-
-class RefundMessage extends TransactionMessage {
- function __construct( $values = array() ) {
- $this->loadDefaults( "refund" );
-
- $this->txn_id_key = 'gateway_refund_id';
-
- parent::__construct( $values );
- }
-}
-
-class RecurringPaymentMessage extends TransactionMessage {
- function __construct( $values = array() ) {
- $this->loadDefaults( "recurring_payment" );
-
- $this->txn_id_key = 'txn_id';
-
- parent::__construct( $values );
- }
-}
-
-class RecurringSignupMessage extends TransactionMessage {
- function __construct( $values = array() ) {
- $this->loadDefaults( "recurring_signup" );
-
- parent::__construct( $values );
- }
-}
->>>>>>> BRANCH (af4497 Comment that HHVM will mess up this code)
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 3b00acb..0000000
--- a/sites/all/modules/queue2civicrm/tests/phpunit/ProcessMessageTest.php
+++ /dev/null
@@ -1,128 +0,0 @@
-<<<<<<< HEAD (9a63b8 (FR #1845) Assert no unconsumed tokens while rendering
thank)
-=======
-<?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();
-
- queue2civicrm_import( $message );
-
- $contributions = wmf_civicrm_get_contributions_from_gateway_id(
$message->getGateway(), $message->getGatewayTxnId() );
- $this->assertEquals( 1, count( $contributions ) );
- }
-
- 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 );
-
- 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(),
- ) );
-
- recurring_import( $message );
- }
-
- /**
- * @expectedException WmfException
- * @expectedExceptionCode INVALID_RECURRING
- */
- public function testRecurringNoSubscrId() {
- $message = new RecurringPaymentMessage( array(
- 'subscr_id' => null,
- ) );
-
- 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' ),
- ) );
-
- 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 (af4497 Comment that HHVM will mess up this code)
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 95c683e..0000000
---
a/sites/all/modules/recurring_globalcollect/tests/RecurringGlobalcollectTest.php
+++ /dev/null
@@ -1,73 +0,0 @@
-<<<<<<< HEAD (9a63b8 (FR #1845) Assert no unconsumed tokens while rendering
thank)
-=======
-<?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' => "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'];
- }
-
- function tearDown() {
- variable_set( 'standalone_globalcollect_adapter_path',
$this->original_standalone_globalcollect_adapter_path );
- parent::tearDown();
- }
-
- 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 (af4497 Comment that HHVM will mess up this code)
diff --git a/sites/all/modules/wmf_civicrm/tests/phpunit/NameSplitTest.php
b/sites/all/modules/wmf_civicrm/tests/phpunit/NameSplitTest.php
deleted file mode 100644
index e3e180e..0000000
--- a/sites/all/modules/wmf_civicrm/tests/phpunit/NameSplitTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-
-class NameSplitTest extends BaseWmfDrupalPhpUnitTestCase {
- public static function getInfo() {
- return array(
- 'name' => 'WmfCivicrm name splitting',
- 'group' => 'WmfCivicrm',
- 'description' => 'Check insane name split nonsense',
- );
- }
-
- /**
- * @dataProvider getNames
- */
- public function testSplit( $full_name, $expected ) {
- $names = wmf_civicrm_janky_split_name( $full_name );
- $this->assertEquals( $expected, $names );
- }
-
- function getNames() {
- return array(
- array( 'Fu Bar', array( 'Fu', 'Bar' ) ),
- array( 'Fubar', array( 'Fubar', '' ) ),
- array( 'Yellow Rubber Ducky', array( 'Yellow', 'Rubber Ducky' ) ),
- );
- }
-}
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 2b4d02c..0000000
--- a/sites/all/modules/wmf_civicrm/tests/phpunit/RecurringTest.php
+++ /dev/null
@@ -1,98 +0,0 @@
-<<<<<<< HEAD (9a63b8 (FR #1845) Assert no unconsumed tokens while rendering
thank)
-=======
-<?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' ) ) {
- throw new PHPUnit_Framework_SkippedTestError( '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 (af4497 Comment that HHVM will mess up this code)
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 e7a13e9..0000000
--- a/sites/all/modules/wmf_common/tests/phpunit/WmfTransactionTest.php
+++ /dev/null
@@ -1,164 +0,0 @@
-<<<<<<< HEAD (9a63b8 (FR #1845) Assert no unconsumed tokens while rendering
thank)
-=======
-<?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",
- "5-argument form is renormalized to 4-form" );
-
- $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(
- "432", $transaction->timestamp,
- "timestamp is correctly parsed" );
- $this->assertEquals(
- $transaction->get_unique_id(), "RFD GLOBALCOLLECT 1234",
- "4-argument form is renormalized correctly" );
-
- $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" ),
- "3-argument form is renormalized correctly" );
-
- $transaction = WmfTransaction::from_unique_id( "GLOBALCOLLECT 1234" );
- $this->assertEquals(
- $transaction->gateway_txn_id, "1234",
- "2-argument form gateway_txn_id is parsed correctly." );
- $this->assertNull( $transaction->timestamp,
- "timestamp is not unnecessarily invented" );
- }
-
- public function testParseMessage() {
- $msg = array(
- 'gateway' => "globalcollect",
- 'gateway_txn_id' => "1234",
- 'recurring' => null,
- );
- $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/", $transaction->get_unique_id()
),
- "parsed message has correct trxn_id" );
- }
-
- /**
- * @expectedException WmfException
- * @expectedExceptionCode INVALID_MESSAGE
- */
- function testInvalidEmptyId() {
- $transaction = WmfTransaction::from_unique_id( "" );
- }
-
- /**
- * @expectedException WmfException
- * @expectedExceptionCode INVALID_MESSAGE
- */
- function testInvalidAlmostEmptyId() {
- $transaction = WmfTransaction::from_unique_id( 'RFD RECURRING' );
- }
-
- /**
- * @expectedException WmfException
- * @expectedExceptionCode INVALID_MESSAGE
- */
- function testInvalidWhitespaceId() {
- $transaction = WmfTransaction::from_unique_id( 'RFD RECURRING ' );
- }
-
- /**
- * @expectedException WmfException
- * @expectedExceptionCode INVALID_MESSAGE
- */
- function testInvalidExtraPartsId() {
- $transaction = WmfTransaction::from_unique_id( 'TEST_GATEWAY 123 1234
EXTRA_PART' );
- }
-
- /**
- * @expectedException WmfException
- * @expectedExceptionCode INVALID_MESSAGE
- */
- function testInvalidTimestampId() {
- $transaction = WmfTransaction::from_unique_id( 'TEST_GATEWAY 123
BAD_TIMESTAMP' );
- }
-
- function testExistsNone() {
- $transaction = WmfTransaction::from_unique_id( 'TEST_GATEWAY ' .
mt_rand() );
- $this->assertEquals( false, $transaction->exists() );
- }
-
- function testExistsOne() {
- $gateway_txn_id = mt_rand();
- $msg = array(
- 'gross' => 1,
- 'currency' => 'USD',
- 'gateway' => 'TEST_GATEWAY',
- 'gateway_txn_id' => $gateway_txn_id,
- 'payment_method' => 'cc',
- 'email' => '[email protected]',
- );
- wmf_civicrm_contribution_message_import( $msg );
- $transaction = WmfTransaction::from_unique_id( 'TEST_GATEWAY ' .
$gateway_txn_id );
- $this->assertEquals( true, $transaction->exists() );
- }
-
- /**
- * @expectedException NonUniqueTransaction
- */
- function testGetContributionMany() {
- $gateway_txn_id = mt_rand();
- $api = civicrm_api_classapi();
- $api->Contact->create( array(
- 'contact_type' => 'Individual',
- 'display_name' => 'test',
- 'version' => 3,
- ) );
- $params = array(
- 'contact_id' => $api->values[0]->id,
- 'contribution_type' => 'Cash',
- 'total_amount' => 1,
- 'version' => 3,
- );
- $api->Contribution->create( $params );
- wmf_civicrm_set_custom_field_values( $api->values[0]->id, array(
- 'gateway' => 'TEST_GATEWAY',
- 'gateway_txn_id' => $gateway_txn_id,
- ) );
- $api->Contribution->create( $params );
- wmf_civicrm_set_custom_field_values( $api->values[0]->id, array(
- 'gateway' => 'TEST_GATEWAY',
- 'gateway_txn_id' => $gateway_txn_id,
- ) );
-
- $transaction = WmfTransaction::from_unique_id( 'TEST_GATEWAY ' .
$gateway_txn_id );
- $transaction->getContribution();
- }
-}
->>>>>>> BRANCH (af4497 Comment that HHVM will mess up this code)
--
To view, visit https://gerrit.wikimedia.org/r/153443
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id70abd01a4cbb401a5a1617bcd223ec7a351bc07
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: deployment
Gerrit-Owner: Awight <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits