Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-8663

Create test for soft_credit_to on contribute API

    Details

    • Type: Patch
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.4.5, 4.0.5
    • Fix Version/s: 3.4.6, 4.0.6
    • Component/s: CiviCRM API
    • Labels:
      None

      Description

      /*

      • This is the test for creating soft credits - however a 'get' is not yet possible via API
      • as the current BAO functions are contact-centric (from what I can find)
      • */
        function testCreateContributionWithSoftCredt()

        { $description = "Demonstrates creating contribution with SoftCredit"; $subfile = "ContributionCreateWithSoftCredit"; $contact2 = civicrm_api('Contact', 'create', array('version' => 3,'display_name' => 'superman', 'version' => 3, 'contact_type' => 'Individual')); $params = $this->params + array( 'soft_credit_to' => $contact2['id'], ); $contribution=& civicrm_api('contribution', 'create', $params); $this->documentMe($params, $contribution,__FUNCTION__,__FILE__,$description, $subfile); // $result = civicrm_api('contribution','get', array('version' => 3,'return'=> 'soft_credit_to', 'sequential' => 1)); // $this->assertAPISuccess($result); // $this->assertEquals($contact2['id'], $result['values'][$result['id']]['soft_credit_to']) ; // well - the above doesn't work yet so lets do SQL $query = "SELECT count(*) FROM civicrm_contribution_soft WHERE contact_id = " . $contact2['id']; $count = CRM_Core_DAO::singleValueQuery( $query); $this->assertEquals(1,$count) ; civicrm_api('contribution', 'delete', array('version' => 3, 'id' => $contribution['id'])); civicrm_api('contact', 'delete', array('version' => 3, 'id' => $contact2['id'])); }

        Attachments

          Activity

            People

            • Assignee:
              eileen Eileen McNaughton
              Reporter:
              eileen Eileen McNaughton
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: