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

Test in api failing on non-api functionality (but required for import)

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.2.0
    • Fix Version/s: 4.2.0
    • Component/s: None
    • Labels:
      None

      Description

      Have been looking at API test failures but this one is failing on functionality only required by CRM_Import_Parser_Contact::createContact().

      The correct fix (from an API perspective) is to remove the handling that is causing the error since it's not supported to call this function directly from outside the API & the API doesn't call the functionality, & the API does error handling by throwing exceptions. But that might further break import.

      Index: api/v3/Contact.php
      ===================================================================
      — api/v3/Contact.php (revision 39827)
      +++ api/v3/Contact.php (working copy)

      @@ -360,15 +360,7 @@
      $ids = implode(',', CRM_Dedupe_Finder::dupesByParams($dedupeParams, $params['contact_type'], 'Strict', array(), $dedupeRuleGroupID));

      if ($ids != NULL) {

      • if ($dupeErrorArray) { - $error = CRM_Core_Error::createError("Found matching contacts: $ids", - CRM_Core_Error::DUPLICATE_CONTACT, - 'Fatal', $ids - ); - return civicrm_api3_create_error($error->pop()); - }

        -

      • return civicrm_api3_create_error("Found matching contacts: $ids");
        + throw new Exception("Found matching contacts: $ids");
        }
        }

      1) api_v3_ContactTest::testCheckParamsWithDuplicateContact2
      array_pop() expects parameter 1 to be array, null given

      C:\utils\apps\civicrm\trunk\packages\PEAR\ErrorStack.php:450
      C:\utils\apps\civicrm\trunk\packages\PEAR\ErrorStack.php:536
      C:\utils\apps\civicrm\trunk\CRM\Core\Error.php:494
      C:\utils\apps\civicrm\trunk\api\v3\Contact.php:367
      C:\utils\apps\civicrm\trunk\tests\phpunit\api\v3\ContactTest.php:770
      c:\utils\apps\civicrm\trunk\tools\scripts\phpunit:76

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              eileen Eileen McNaughton
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: