Awight has uploaded a new change for review.
https://gerrit.wikimedia.org/r/155450
Change subject: Merge remote-tracking branch 'origin/master' into HEAD
......................................................................
Merge remote-tracking branch 'origin/master' into HEAD
Change-Id: I396dc0a427df092f924436f15cc3062cb9e382b0
---
D sites/all/modules/queue2civicrm/tests/phpunit/ProcessMessageTest.php
D sites/all/modules/wmf_common/tests/includes/BaseWmfDrupalPhpUnitTestCase.php
D sites/all/modules/wmf_communication/tests/phpunit/CiviMailTest.php
3 files changed, 0 insertions(+), 289 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm
refs/changes/50/155450/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 94c3a56..0000000
--- a/sites/all/modules/queue2civicrm/tests/phpunit/ProcessMessageTest.php
+++ /dev/null
@@ -1,135 +0,0 @@
-<<<<<<< HEAD (7ff8e5 Override 25 row limit for api fetch)
-=======
-<?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();
-
- 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 );
-
- 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 (f66475 fix typo)
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 f212364..0000000
---
a/sites/all/modules/wmf_common/tests/includes/BaseWmfDrupalPhpUnitTestCase.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<<<<<<< HEAD (7ff8e5 Override 25 row limit for api fetch)
-=======
-<?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." );
- }
- }
-}
->>>>>>> BRANCH (f66475 fix typo)
diff --git a/sites/all/modules/wmf_communication/tests/phpunit/CiviMailTest.php
b/sites/all/modules/wmf_communication/tests/phpunit/CiviMailTest.php
deleted file mode 100644
index 4d6e105..0000000
--- a/sites/all/modules/wmf_communication/tests/phpunit/CiviMailTest.php
+++ /dev/null
@@ -1,140 +0,0 @@
-<?php
-namespace wmf_communication;
-
-use \BaseWmfDrupalPhpUnitTestCase;
-use \CiviMailStore;
-/**
- * Tests for CiviMail helper classes
- */
-class CiviMailTest extends BaseWmfDrupalPhpUnitTestCase {
-
- protected $source = 'wmf_connumication_test';
- protected $body = '<p>Dear Wikipedia supporter,</p><p>You are
beautiful.</p>';
- protected $subject = 'Thank you';
- protected $mailStore;
- protected $contactID;
- protected $emailID;
-
- public function setUp() {
- parent::setUp();
- civicrm_initialize();
- $this->mailStore = new CiviMailStore();
-
- $emailResult = civicrm_api3( 'Email', 'get', array(
- 'email' => '[email protected]',
- ) );
- $firstResult = reset( $emailResult['values'] );
- if ( $firstResult ) {
- $this->emailID = $firstResult['id'];
- $this->contactID = $firstResult['contact_id'];
- } else {
- $contactResult = civicrm_api3( 'Contact', 'create',
array(
- 'first_name' => 'Trius',
- 'last_name' => 'Hondo',
- 'contact_type' => 'Individual',
- ) );
- $this->contactID = $contactResult['id'];
- $emailResult = civicrm_api3( 'Email', 'create', array(
- 'email' => '[email protected]',
- 'contact_id' => $this->contactID
- ) );
- $this->emailID = $emailResult['id'];
- }
- }
-
- public function tearDown() {
- civicrm_api3( 'Email', 'delete', array( 'id' => $this->emailID
) );
- civicrm_api3( 'Contact', 'delete', array( 'id' =>
$this->contactID ) );
- }
-
- public function testAddMailing() {
- $name = 'test_mailing';
- $revision = mt_rand();
- $storedMailing = $this->mailStore->addMailing(
- $this->source,
- $name,
- $this->body,
- $this->subject,
- $revision
- );
- $this->assertInstanceOf(
- 'ICiviMailingRecord',
- $storedMailing,
- 'addMailing should return an ICiviMailingRecord'
- );
- $this->assertTrue(
- is_numeric( $storedMailing->getMailingID() ),
- 'CiviMailingRecord should have a numeric mailing ID'
- );
- }
-
- public function testGetMailing() {
- $name = 'test_mailing';
- $revision = mt_rand();
- $storedMailing = $this->mailStore->addMailing(
- $this->source,
- $name,
- $this->body,
- $this->subject,
- $revision
- );
- $retrievedMailing = $this->mailStore->getMailing(
- $this->source,
- $name,
- $revision
- );
- $this->assertEquals(
- $storedMailing->getMailingID(),
- $retrievedMailing->getMailingID(),
- 'Retrieved mailing has wrong MailingID'
- );
- $this->assertEquals(
- $storedMailing->getJobID(),
- $retrievedMailing->getJobID(),
- 'Retrieved mailing has wrong JobID'
- );
- }
-
- /**
- * @expectedException CiviMailingMissingException
- */
- public function testMissingMailing() {
- $this->mailStore->getMailing( 'fakeSource', 'fakeName',
mt_rand() );
- }
-
- public function testAddQueueRecord() {
- $name = 'test_mailing';
- $revision = mt_rand();
- $storedMailing = $this->mailStore->addMailing(
- $this->source,
- $name,
- $this->body,
- $this->subject,
- $revision
- );
- $queueRecord = $this->mailStore->addQueueRecord(
- $storedMailing,
- '[email protected]',
- '20140205104611'
- );
- $this->assertInstanceOf(
- 'ICiviMailQueueRecord',
- $queueRecord,
- 'addQueueRecord should return an ICiviMailQueueRecord'
- );
- $this->assertTrue(
- is_numeric( $queueRecord->getQueueID() ),
- 'CiviMailQueueRecord should have a numeric ID'
- );
- $this->assertEquals(
- $this->contactID,
- $queueRecord->getContactID(),
- 'CiviMailQueueRecord has wrong contact ID'
- );
- $this->assertEquals(
- $this->emailID,
- $queueRecord->getEmailID(),
- 'CiviMailQueueRecord has wrong email ID'
- );
- }
-}
\ No newline at end of file
--
To view, visit https://gerrit.wikimedia.org/r/155450
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I396dc0a427df092f924436f15cc3062cb9e382b0
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