CRM-17092 add test to ensure contribution_recur_id is being set'
authoreileenmcnaugton <eileen@fuzion.co.nz>
Wed, 26 Aug 2015 22:54:12 +0000 (10:54 +1200)
committereileenmcnaugton <eileen@fuzion.co.nz>
Wed, 26 Aug 2015 22:56:00 +0000 (10:56 +1200)
CRM/Core/Payment/Dummy.php
tests/phpunit/CRM/Member/Form/MembershipRenewalTest.php

index f4e54d6c45f47ce50c3915260ca92f1ce1279547..7a40da5f7921eec81e921b864fb669ff1f245202 100644 (file)
@@ -80,7 +80,9 @@ class CRM_Core_Payment_Dummy extends CRM_Core_Payment {
     // the back-end's canonical set of parameters.  But if a processor
     // does this, it needs to invoke this hook after it has done translation,
     // but before it actually starts talking to its proprietary back-end.
-
+    if (!empty($params['is_recur'])) {
+      $throwAnENoticeIfNotSetAsTheseAreRequired = $params['frequency_interval'] . $params['frequency_unit'];
+    }
     // no translation in Dummy processor
     $cookedParams = $params;
     CRM_Utils_Hook::alterPaymentProcessorParams($this,
index fb95bda61d19587793bd9dfd46f89650a9240b82..ca7b17a571cfaa3166eaf395c6bbb43ee6086b62 100644 (file)
@@ -308,7 +308,8 @@ class CRM_Member_Form_MembershipRenewalTest extends CiviUnitTestCase {
 
     $form->testSubmit($params);
     $membership = $this->callAPISuccessGetSingle('Membership', array('contact_id' => $this->_individualId));
-    $this->callAPISuccessGetCount('ContributionRecur', array('contact_id' => $this->_individualId), 1);
+    $contributionRecur = $this->callAPISuccessGetSingle('ContributionRecur', array('contact_id' => $this->_individualId));
+    $this->assertEquals($contributionRecur['id'], $membership['contribution_recur_id']);
 
     $contribution = $this->callAPISuccess('Contribution', 'getsingle', array(
       'contact_id' => $this->_individualId,
@@ -327,6 +328,7 @@ class CRM_Member_Form_MembershipRenewalTest extends CiviUnitTestCase {
     ), 1);
 
   }
+
   /**
    * Test the submit function of the membership form.
    */