Awight has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/192392

Change subject: Merge master into deployment
......................................................................

Merge master into deployment

c5262a82e66f148713f733380cb372a881a578b2 Don't reject mismatching refund amounts

Change-Id: Id0a8d09cafdb94e892dfcfd6c105c2dca7cbb5f5
---
D sites/all/modules/wmf_civicrm/tests/phpunit/NormalizeMessageTest.php
D sites/all/modules/wmf_civicrm/tests/phpunit/RefundTest.php
2 files changed, 0 insertions(+), 237 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/92/192392/1

diff --git 
a/sites/all/modules/wmf_civicrm/tests/phpunit/NormalizeMessageTest.php 
b/sites/all/modules/wmf_civicrm/tests/phpunit/NormalizeMessageTest.php
deleted file mode 100644
index bdddb48..0000000
--- a/sites/all/modules/wmf_civicrm/tests/phpunit/NormalizeMessageTest.php
+++ /dev/null
@@ -1,78 +0,0 @@
-<<<<<<< HEAD   (f594a6 Merge master into deployment)
-=======
-<?php
-
-class NormalizeMessageTest extends BaseWmfDrupalPhpUnitTestCase {
-    public static function getInfo() {
-        return array(
-            'name' => 'WmfCivicrm message normalization',
-            'group' => 'Pipeline',
-            'description' => 'Checks for queue message normalization behavior',
-        );
-    }
-
-    public function testDoubleNormalization() {
-        // Start with a message already in normal form, to make comparison easy
-        $original_msg = array(
-            'anonymous' => 0,
-            'check_number' => '',
-            'city' => '',
-            'comment' => '',
-            'contact_id' => mt_rand(),
-            'contact_tags' => array(),
-            'contribution_recur_id' => mt_rand(),
-            'contribution_tags' => array(),
-            'contribution_tracking_id' => mt_rand(),
-            'contribution_tracking_update' => '1',
-            'contribution_type' => 'cash', // FIXME
-            'contribution_type_id' => '9', // FIXME
-            'country' => 'IL',
-            'create_date' => time() + 11,
-            'currency' => 'USD',
-            'date' => time() + 1,
-            'effort_id' => '2',
-            'email' => '[email protected]',
-            'fee' => 0.5,
-            'first_name' => 'test',
-            'gateway' => 'paypal',
-            'gateway_txn_id' => '1234AB1234-2',
-            'gross' => 5.8,
-            'last_name' => 'es',
-            'letter_code' => '',
-            'middle_name' => '',
-            'net' => 5.29,
-            'optout' => 0,
-            'organization_name' => '',
-            'original_currency' => 'ILS',
-            'original_gross' => '20.00',
-            'payment_date' => time(),
-            'payment_instrument_id' => '25',
-            'payment_instrument' => 'Paypal',
-            'postal_code' => '',
-            'postmark_date' => null,
-            'recurring' => '1',
-            'source_enqueued_time' => time() + 2,
-            'source_host' => 'thulium',
-            'source_name' => 'PayPal IPN (legacy)',
-            'source_run_id' => mt_rand(),
-            'source_type' => 'listener',
-            'source_version' => 'legacy',
-            'start_date' => time() + 10,
-            'state_province' => '',
-            'street_address' => '',
-            'subscr_id' => 'TEST-S-1234567' . mt_rand(),
-            'supplemental_address_1' => '',
-            'supplemental_address_2' => '',
-            'thankyou_date' => '',
-            'txn_type' => 'subscr_payment',
-            'utm_campaign' => '',
-        );
-
-        $msg = $original_msg;
-        $normal_msg_1 = wmf_civicrm_normalize_msg( $msg );
-        $this->assertEquals( $original_msg, $normal_msg_1 );
-        $normal_msg_2 = wmf_civicrm_normalize_msg( $normal_msg_1 );
-        $this->assertEquals( $original_msg, $normal_msg_2 );
-    }
-}
->>>>>>> BRANCH (c5262a Don't reject mismatching refund amounts)
diff --git a/sites/all/modules/wmf_civicrm/tests/phpunit/RefundTest.php 
b/sites/all/modules/wmf_civicrm/tests/phpunit/RefundTest.php
deleted file mode 100644
index 8d60cf7..0000000
--- a/sites/all/modules/wmf_civicrm/tests/phpunit/RefundTest.php
+++ /dev/null
@@ -1,159 +0,0 @@
-<?php
-
-class RefundTest extends BaseWmfDrupalPhpUnitTestCase {
-    public static function getInfo() {
-        return array(
-            'name' => 'Refund',
-            'group' => 'Pipeline',
-            'description' => 'Test refund handling.',
-        );
-    }
-
-    public function setUp() {
-        parent::setUp();
-        civicrm_initialize();
-
-        $results = civicrm_api3( 'contact', 'create', array(
-            'contact_type' => 'Individual',
-            'first_name' => 'Test',
-            'last_name' => 'Es',
-        ) );
-        $this->contact_id = $results['id'];
-
-        $this->original_currency = 'EUR';
-        $this->original_amount = '1.23';
-        $this->gateway_txn_id = mt_rand();
-        $time = time();
-        $this->trxn_id = "TEST_GATEWAY {$this->gateway_txn_id} {$time}";
-
-        $results = civicrm_api3( 'contribution', 'create', array(
-            'contact_id' => $this->contact_id,
-            'contribution_type' => 'Cash',
-            'total_amount' => $this->original_amount,
-            'contribution_source' => $this->original_currency . ' ' . 
$this->original_amount,
-            'receive_date' => wmf_common_date_unix_to_civicrm( $time ),
-            'trxn_id' => $this->trxn_id,
-        ) );
-        $this->original_contribution_id = $results['id'];
-
-        $this->refund_contribution_id = null;
-    }
-
-    public function tearDown() {
-        civicrm_api3( 'contribution', 'delete', array(
-            'id' => $this->original_contribution_id,
-        ) );
-
-        if ( $this->refund_contribution_id ) {
-            civicrm_api3( 'contribution', 'delete', array(
-                'id' => $this->refund_contribution_id,
-            ) );
-        }
-
-        civicrm_api3( 'contact', 'delete', array(
-            'id' => $this->contact_id,
-        ) );
-
-        parent::tearDown();
-    }
-
-    /**
-     * Covers wmf_civicrm_mark_refund
-     */
-    public function testMarkRefund() {
-        $this->refund_contribution_id = wmf_civicrm_mark_refund( 
$this->original_contribution_id );
-
-        $this->assertNotNull( $this->refund_contribution_id,
-            "Refund created" );
-
-        $results = civicrm_api3( 'contribution', 'get', array(
-            'id' => $this->original_contribution_id,
-        ) );
-        $contribution = array_pop( $results['values'] );
-
-        $this->assertEquals( 'Refunded', $contribution['contribution_status'],
-            'Refunded contribution has correct status' );
-
-        $results = civicrm_api3( 'contribution', 'get', array(
-            'id' => $this->refund_contribution_id,
-        ) );
-        $refund_contribution = array_pop( $results['values'] );
-
-        $this->assertEquals( 'Refund', 
$refund_contribution['contribution_type'] );
-        $this->assertEquals( 'Pending', 
$refund_contribution['contribution_status'] );
-        $this->assertEquals(
-            "{$this->original_currency} -{$this->original_amount}",
-            $refund_contribution['contribution_source'] );
-    }
-
-    /**
-     * Make a refund with type set to "chargeback"
-     */
-    public function testMarkRefundWithType() {
-        $this->refund_contribution_id = wmf_civicrm_mark_refund( 
$this->original_contribution_id, 'chargeback' );
-
-        $api = civicrm_api_classapi();
-        $results = civicrm_api3( 'contribution', 'get', array(
-            'id' => $this->refund_contribution_id,
-
-            'version' => 3,
-        ) );
-        $contribution = array_pop( $results['values'] );
-
-        $this->assertEquals( 'Chargeback', $contribution['contribution_type'],
-            'Refund contribution has correct type' );
-    }
-
-    /**
-     * Make a refund for less than the original amount
-     */
-    public function testMakeLesserRefund() {
-        $lesser_amount = round( $this->original_amount - 0.25, 2 );
-        $this->refund_contribution_id = wmf_civicrm_mark_refund(
-            $this->original_contribution_id,
-            'chargeback',
-            true, null, null,
-            $this->original_currency, $lesser_amount
-        );
-
-        $results = civicrm_api3( 'contribution', 'get', array(
-            'id' => $this->refund_contribution_id,
-
-            'version' => 3,
-        ) );
-        $refund_contribution = array_pop( $results['values'] );
-
-        $this->assertEquals(
-            "{$this->original_currency} -{$lesser_amount}",
-            $refund_contribution['contribution_source'],
-            'Refund contribution has correct lesser amount' );
-    }
-
-    /**
-     * Make a refund in the wrong currency
-     *
-     * @expectedException WmfException
-     */
-    public function testMakeWrongCurrencyRefund() {
-        $wrong_currency = 'GBP';
-        $this->assertNotEquals( $this->original_currency, $wrong_currency );
-        wmf_civicrm_mark_refund(
-            $this->original_contribution_id, 'refund',
-            true, null, null,
-            $wrong_currency, $this->original_amount
-        );
-    }
-
-    /**
-     * Make a refund for too much
-     *
-     * @expectedException WmfException
-     */
-    public function testMakeScammerRefund() {
-        wmf_civicrm_mark_refund(
-            $this->original_contribution_id, 'refund',
-            true, null, null,
-            $this->original_currency, $this->original_amount + 100.00
-        );
-    }
-}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id0a8d09cafdb94e892dfcfd6c105c2dca7cbb5f5
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: deployment
Gerrit-Owner: Awight <[email protected]>

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

Reply via email to