CRM-13149 add relationship type id as a filter option for both 'paths', add tests...
authoreileen <eileen@fuzion.co.nz>
Fri, 2 Aug 2013 10:39:25 +0000 (22:39 +1200)
committereileen <eileen@fuzion.co.nz>
Fri, 2 Aug 2013 10:39:25 +0000 (22:39 +1200)
12 files changed:
CRM/Contact/BAO/Relationship.php
api/v3/Relationship.php
tests/phpunit/CRM/Core/Payment/BaseIPNTest.php
tests/phpunit/CRM/Member/BAO/MembershipTest.php
tests/phpunit/CiviTest/CiviUnitTestCase.php
tests/phpunit/api/v3/MembershipPaymentTest.php
tests/phpunit/api/v3/MembershipStatusTest.php
tests/phpunit/api/v3/MembershipTest.php
tests/phpunit/api/v3/MembershipTypeTest.php
tests/phpunit/api/v3/PriceFieldValueTest.php
tests/phpunit/api/v3/RelationshipTest.php
tests/phpunit/api/v3/RelationshipTypeTest.php

index 93ef64b11e806dc8600807323e8390598c4c488b..b2ce7079e4551d5425e50a7f3d4275c99f621272 100644 (file)
@@ -779,12 +779,13 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship {
    * @param int $count get the no of relationships
    * $param int $relationshipId relationship id
    * @param string $direction   the direction we are interested in a_b or b_a
+   * @param array $params array of extra values including relationship_type_id per api spec
    *
    * return string the query for this diretion
    * @static
    * @access public
    */
-  static function makeURLClause($contactId, $status, $numRelationship, $count, $relationshipId, $direction) {
+  static function makeURLClause($contactId, $status, $numRelationship, $count, $relationshipId, $direction, $params = array()) {
     $select = $from = $where = '';
 
     $select = '( ';
@@ -886,7 +887,15 @@ LEFT JOIN  civicrm_country ON (civicrm_address.country_id = civicrm_country.id)
 
     // CRM-6181
     $where .= ' AND civicrm_contact.is_deleted = 0';
-
+    if(!empty($params['relationship_type_id'])) {
+      if(is_array($params['relationship_type_id'])) {
+        // get our special function from DAO to deal with this
+       // $where .=  $this->createSQLFilter('relationship_type_id', $params['relationship_type_id'], 'Integer');
+      }
+      else {
+        $where .= ' AND relationship_type_id = ' . CRM_Utils_Type::escape($params['relationship_type_id'], 'Positive');
+      }
+    }
     if ($direction == 'a_b') {
       $where .= ' ) UNION ';
     }
@@ -908,7 +917,7 @@ LEFT JOIN  civicrm_country ON (civicrm_address.country_id = civicrm_country.id)
    * $param array $links the list of links to display
    * $param int   $permissionMask  the permission mask to be applied for the actions
    * $param boolean $permissionedContact to return only permissioned Contact
-   *
+   * $param array $params array of variables consistent with filters supported by the api
    * return array $values relationship records
    * @static
    * @access public
@@ -917,7 +926,8 @@ LEFT JOIN  civicrm_country ON (civicrm_address.country_id = civicrm_country.id)
     $status              = 0, $numRelationship = 0,
     $count               = 0, $relationshipId = 0,
     $links               = NULL, $permissionMask = NULL,
-    $permissionedContact = FALSE
+    $permissionedContact = FALSE,
+    $params = array()
   ) {
     $values = array();
     if (!$contactId && !$relationshipId) {
@@ -925,10 +935,10 @@ LEFT JOIN  civicrm_country ON (civicrm_address.country_id = civicrm_country.id)
     }
 
     list($select1, $from1, $where1) = self::makeURLClause($contactId, $status, $numRelationship,
-      $count, $relationshipId, 'a_b'
+      $count, $relationshipId, 'a_b', $params
     );
     list($select2, $from2, $where2) = self::makeURLClause($contactId, $status, $numRelationship,
-      $count, $relationshipId, 'b_a'
+      $count, $relationshipId, 'b_a', $params
     );
 
     $order = $limit = '';
index e6ba8153f529b191dd0468c9b2a4439bd2cbdbda..0e754690da2b052f46df95cec2c02624c9f4355e 100644 (file)
@@ -136,7 +136,7 @@ function civicrm_api3_relationship_delete($params) {
  * @access  public
  */
 function civicrm_api3_relationship_get($params) {
-
+  $options = _civicrm_api3_get_options_from_params($params);
   if (!CRM_Utils_Array::value('contact_id', $params)) {
     $relationships = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, FALSE);
   }
@@ -145,15 +145,21 @@ function civicrm_api3_relationship_get($params) {
     $relationships = CRM_Contact_BAO_Relationship::getRelationship($params['contact_id'],
       CRM_Utils_Array::value('status_id', $params),
       0,
-      0,
-      CRM_Utils_Array::value('id', $params), NULL
+      CRM_Utils_Array::value('is_count', $options),
+      CRM_Utils_Array::value('id', $params),
+      NULL,
+      NULL,
+      FALSE,
+      $params
     );
   }
+  //perhaps we should add a 'getcount' but at this stage lets just handle getcount output
+  if($options['is_count']) {
+    return array('count' => $relationships);
+  }
   foreach ($relationships as $relationshipId => $values) {
     _civicrm_api3_custom_data_get($relationships[$relationshipId], 'Relationship', $relationshipId, NULL, CRM_Utils_Array::value('relationship_type_id',$values));
   }
-
-
   return civicrm_api3_create_success($relationships, $params);
 }
 
index def539fe07d2383abbfbfbf95f9ea3ba75c72823..3c883b7180af06321022cf9c246c11102021abd6 100644 (file)
@@ -485,7 +485,7 @@ class CRM_Core_Payment_BaseIPNTest extends CiviUnitTestCase {
      */
   function _setUpMembershipObjects() {
     try {
-      $this->_membershipTypeID = $this->membershipTypeCreate($this->_contactId);
+      $this->_membershipTypeID = $this->membershipTypeCreate(array('member_of_contact_id' => $this->_contactID));
       $this->_membershipStatusID = $this->membershipStatusCreate('test status');
     }
     catch(Exception$e) {
index a24ad5170fcf920b6ffa404f782cd60dd748ff59..64c409ba61ba93a575e52fe750025e9cbcb1dfe0 100644 (file)
@@ -66,7 +66,7 @@ class CRM_Member_BAO_MembershipTest extends CiviUnitTestCase {
     );
 
     $this->_contactID = $this->organizationCreate();
-    $this->_membershipTypeID = $this->membershipTypeCreate($this->_contactID);
+    $this->_membershipTypeID = $this->membershipTypeCreate(array('member_of_contact_id' => $this->_contactID));
     // add a random number to avoid silly conflicts with old data
     $this->_membershipStatusID = $this->membershipStatusCreate('test status' . rand(1, 1000));
   }
index dee899682105ad34f164588d57179fe57d3de696..0a2ef235d0ca5863cbcea3ea0f79b97c86fee8d1 100644 (file)
@@ -940,36 +940,26 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
     }
   }
 
-  function membershipTypeCreate($contactID, $contributionTypeID = 1, $version = 3) {
-    require_once 'CRM/Member/PseudoConstant.php';
+  function membershipTypeCreate($params = array()) {
     CRM_Member_PseudoConstant::flush('membershipType');
     CRM_Core_Config::clearDBCache();
-    $params = array(
+    $params = array_merge(array(
       'name' => 'General',
       'duration_unit' => 'year',
       'duration_interval' => 1,
       'period_type' => 'rolling',
-      'member_of_contact_id' => $contactID,
+      'member_of_contact_id' => 1,
       'domain_id' => 1,
-      // FIXME: I know it's 1, cause it was loaded directly to the db.
-      // FIXME: when we load all the data, we'll need to address this to
-      // FIXME: avoid hunting numbers around.
-      'financial_type_id' => $contributionTypeID,
+      'financial_type_id' => 1,
       'is_active' => 1,
-      'version' => $version,
       'sequential' => 1,
       'visibility' => 1,
-    );
+    ), $params);
+
+    $result = $this->callAPISuccess('MembershipType', 'Create', $params);
 
-    $result = civicrm_api('MembershipType', 'Create', $params);
-    require_once 'CRM/Member/PseudoConstant.php';
     CRM_Member_PseudoConstant::flush('membershipType');
     CRM_Utils_Cache::singleton()->flush();
-    if (CRM_Utils_Array::value('is_error', $result) ||
-      (!CRM_Utils_Array::value('id', $result) && !CRM_Utils_Array::value('id', $result['values'][0]))
-    ) {
-      throw new Exception('Could not create membership type, with message: ' . CRM_Utils_Array::value('error_message', $result));
-    }
 
     return $result['id'];
   }
@@ -1028,17 +1018,17 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
     return;
   }
 
-  function relationshipTypeCreate($params = NULL) {
-    if (is_null($params)) {
-      $params = array(
+  function relationshipTypeCreate($params = array()) {
+    $params = array_merge(array(
         'name_a_b' => 'Relation 1 for relationship type create',
         'name_b_a' => 'Relation 2 for relationship type create',
         'contact_type_a' => 'Individual',
         'contact_type_b' => 'Organization',
         'is_reserved' => 1,
         'is_active' => 1,
-      );
-    }
+      ),
+       $params
+    );
 
     $result = $this->callAPISuccess('relationship_type', 'create', $params);
     CRM_Core_PseudoConstant::flush('relationshipType');
index 20a82bbb2f9961f3e86747f8b3ff4c7d02ddeb55..9bde832badef67a46cabc3f1ca13c1268588bd56 100644 (file)
@@ -46,7 +46,7 @@ class api_v3_MembershipPaymentTest extends CiviUnitTestCase {
     parent::setUp();
 
     $this->_contactID = $this->organizationCreate(NULL);
-    $this->_membershipTypeID = $this->membershipTypeCreate($this->_contactID, 1);
+    $this->_membershipTypeID = $this->membershipTypeCreate(array('member_of_contact_id' => $this->_contactID));
     $this->_membershipStatusID = $this->membershipStatusCreate('test status');
     $activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, TRUE, 'name');
     $params = array(
index 52dbd1dd777d9659c98b6558a0a99ce523a8aaef..675b22dfdf1055009701a7e17350842ffd811ebe 100644 (file)
@@ -46,7 +46,7 @@ class api_v3_MembershipStatusTest extends CiviUnitTestCase {
   function setUp() {
     parent::setUp();
     $this->_contactID = $this->individualCreate();
-    $this->_membershipTypeID = $this->membershipTypeCreate($this->_contactID);
+    $this->_membershipTypeID = $this->membershipTypeCreate(array('member_of_contact_id' => $this->_contactID));
     $this->_membershipStatusID = $this->membershipStatusCreate('test status');
 
     CRM_Member_PseudoConstant::membershipType($this->_membershipTypeID, TRUE);
index 36e81afe3000e7c10c66ff1f40d73ca34bbb9932..b0053094ae758e5c255b29e944c3edc54581d1cf 100644 (file)
@@ -50,7 +50,7 @@ class api_v3_MembershipTest extends CiviUnitTestCase {
     parent::setUp();
     $this->_apiversion = 3;
     $this->_contactID = $this->individualCreate();
-    $this->_membershipTypeID = $this->membershipTypeCreate($this->_contactID);
+    $this->_membershipTypeID = $this->membershipTypeCreate(array('member_of_contact_id' => $this->_contactID));
     $this->_membershipStatusID = $this->membershipStatusCreate('test status');
 
     require_once 'CRM/Member/PseudoConstant.php';
index e19fd407bdb98ce634423ad58cb214bbe8373234..6b959d2efbdeb0663ea7916c83c953aa0ffa486e 100644 (file)
@@ -69,7 +69,7 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase {
   }
 
   function testGet() {
-    $id = $this->membershipTypeCreate($this->_contactID, 1);
+    $id = $this->membershipTypeCreate(array('member_of_contact_id' => $this->_contactID));
 
     $params = array(
       'id' => $id,
@@ -237,7 +237,7 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase {
   }
 
   function testUpdate() {
-    $id = $this->membershipTypeCreate($this->_contactID, 2);
+    $id = $this->membershipTypeCreate(array('member_of_contact_id' => $this->_contactID, 'financial_type_id' => 2));
     $newMembOrgParams = array(
       'organization_name' => 'New membership organisation',
       'contact_type' => 'Organization',
@@ -271,7 +271,7 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase {
 
   function testDelete() {
     $orgID = $this->organizationCreate(NULL);
-    $membershipTypeID = $this->membershipTypeCreate($orgID, 1);
+    $membershipTypeID = $this->membershipTypeCreate(array('member_of_contact_id' => $orgID));
     $params = array(
       'id' => $membershipTypeID,
     );
index aad09910ca59f21da007780728dc648cb506aa52..2e51f5c8ed06eeb56486d0a1e3846c1674842ae0 100644 (file)
@@ -73,7 +73,7 @@ class api_v3_PriceFieldValueTest extends CiviUnitTestCase {
      );
 
     $membershipOrgId = $this->organizationCreate(NULL);
-    $this->_membershipTypeID = $this->membershipTypeCreate($membershipOrgId);
+    $this->_membershipTypeID = $this->membershipTypeCreate(array('member_of_contact_id' => $membershipOrgId));
     $priceSetparams1 = array(
       'name' => 'priceset',
       'title' => 'Priceset with Multiple Terms',
index a6535a84f944d4449c8e0b9e253d0c64b36cee23..f3e31f18f9cc41a1165efa40dd1295380f683d67 100644 (file)
@@ -80,10 +80,11 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
   }
 
   function tearDown() {
-    $this->quickCleanup(array('civicrm_relationship'), TRUE);
-    $this->relationshipTypeDelete($this->_relTypeID);
     $this->contactDelete($this->_cId_a);
     $this->contactDelete($this->_cId_b);
+    $this->contactDelete($this->_cId_b2);
+    $this->quickCleanup(array('civicrm_relationship'), TRUE);
+    $this->relationshipTypeDelete($this->_relTypeID);
   }
 
   ///////////////// civicrm_relationship_create methods
@@ -214,7 +215,6 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
       'debug' => 1,
     );
     $result = $this->callAPISuccess('relationship', 'create', $params);
-    $this->assertAPISuccess($result, 'in line ' . __LINE__);
     $result = $this->callAPISuccess('relationship', 'get', $params);
     $params['id'] = $relationship['id'];
     $result = $this->callAPISuccess('relationship', 'delete', $params);
@@ -263,7 +263,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
     );
 
     $result = $this->callAPIAndDocument('relationship', 'create', $params, __FUNCTION__, __FILE__);
-    $this->assertNotNull($result['id'], 'in line ' . __LINE__);
+    $this->assertNotNull($result['id']);
     $relationParams = array(
       'id' => $result['id'],
     );
@@ -276,7 +276,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
       if ($key == 'note') {
         continue;
       }
-      $this->assertEquals($value, $values[$key], $key . " doesn't match " . print_r($values, TRUE) . 'in line' . __LINE__);
+      $this->assertEquals($value, $values[$key], $key . " doesn't match " . print_r($values, TRUE));
     }
     $params['id'] = $result['id'];
     $this->callAPISuccess('relationship', 'delete', $params);
@@ -297,7 +297,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
     );
 
     $result = $this->callAPISuccess('relationship', 'create', $params);
-    $this->assertNotNull($result['id'], 'in line ' . __LINE__);
+    $this->assertNotNull($result['id']);
     $relationParams = array(
       'id' => $result['id'],
     );
@@ -500,8 +500,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
       'is_active' => 1,
     );
 
-    $result = $this->callAPIFailure('relationship', 'delete', $params);
-    $this->assertEquals($result['error_message'], 'Mandatory key(s) missing from params array: id');
+    $result = $this->callAPIFailure('relationship', 'delete', $params, 'Mandatory key(s) missing from params array: id');
   }
 
   /**
@@ -514,10 +513,10 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
       'relationship_type_id' => 'Breaking Relationship',
     );
 
-    $result = $this->callAPIFailure('relationship', 'delete', $params, 'Mandatory key(s) missing from params array: id', 'in line ' . __LINE__);
+    $result = $this->callAPIFailure('relationship', 'delete', $params, 'Mandatory key(s) missing from params array: id');
 
     $params['id'] = "Invalid";
-    $result = $this->callAPIFailure('relationship', 'delete', $params, 'Invalid value for relationship ID', 'in line ' . __LINE__);
+    $result = $this->callAPIFailure('relationship', 'delete', $params, 'Invalid value for relationship ID');
   }
 
   /**
@@ -548,8 +547,8 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
    * check with empty array
    */
   function testRelationshipUpdateEmpty() {
-    $result = $this->callAPIFailure('relationship', 'create', array());
-    $this->assertEquals('Mandatory key(s) missing from params array: contact_id_a, contact_id_b, relationship_type_id', $result['error_message'], 'In line ' . __LINE__);
+    $result = $this->callAPIFailure('relationship', 'create', array(),
+      'Mandatory key(s) missing from params array: contact_id_a, contact_id_b, relationship_type_id');
   }
 
   /**
@@ -571,7 +570,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
 
     $result = $this->callAPISuccess('relationship', 'create', $relParams);
 
-    $this->assertNotNull($result['id'], 'In line ' . __LINE__);
+    $this->assertNotNull($result['id']);
     $this->_relationID = $result['id'];
 
     $params = array(
@@ -583,7 +582,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
       'is_active' => 0,
     );
 
-    $result = $this->callAPIFailure('relationship', 'create', $params, 'Relationship already exists', 'In line ' . __LINE__);
+    $result = $this->callAPIFailure('relationship', 'create', $params, 'Relationship already exists');
 
     //delete created relationship
     $params = array(
@@ -616,18 +615,18 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
       'contact_id' => $this->_cId_b,
     );
     $result = $this->callAPISuccess('relationship', 'get', $params);
-    $this->assertEquals($result['count'], 1, 'in line ' . __LINE__);
+    $this->assertEquals($result['count'], 1);
     $params = array(
       'contact_id_a' => $this->_cId_a,
     );
     $result = $this->callAPISuccess('relationship', 'get', $params);
-    $this->assertEquals($result['count'], 1, 'in line ' . __LINE__);
+    $this->assertEquals($result['count'], 1);
     // contact_id_a is wrong so should be no matches
     $params = array(
       'contact_id_a' => $this->_cId_b,
     );
     $result = $this->callAPISuccess('relationship', 'get', $params);
-    $this->assertEquals($result['count'], 0, 'in line ' . __LINE__);
+    $this->assertEquals($result['count'], 0);
   }
 
   /**
@@ -782,8 +781,8 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
       'contact_type_a' => 'Individual',
       'contact_type_b' => 'Organization',
     );
-    $result = $this->callAPIFailure('relationship_type', 'create', $relTypeParams);
-    $this->assertEquals('id is not a valid integer', $result['error_message'], 'in line ' . __LINE__);
+    $result = $this->callAPIFailure('relationship_type', 'create', $relTypeParams,
+      'id is not a valid integer');
   }
 
   /**
@@ -806,7 +805,7 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
     );
 
     $result = $this->callAPISuccess('relationship', 'get', $contacts);
-    $this->assertGreaterThan(0, $result['count'], 'in line ' . __LINE__);
+    $this->assertGreaterThan(0, $result['count']);
     $params = array(
       'id' => $relationship['id'],
     );
@@ -840,5 +839,90 @@ class api_v3_RelationshipTest extends CiviUnitTestCase {
     $result = $this->callAPISuccess('relationship', 'delete', $params);
     $this->relationshipTypeDelete($this->_relTypeID);
   }
+
+  /**
+   * Checks that passing in 'contact_id' + a relationship type
+   * will filter by relationship type (relationships go in both directions)
+   * as relationship api does a reciprocal check if contact_id provided
+   *
+   * We should get 1 result without or with correct relationship type id & 0 with
+   * an incorrect one
+   */
+  function testGetRelationshipByTypeReciprocal() {
+    $created = $this->callAPISuccess($this->_entity, 'create', $this->_params);
+    $result = $this->callAPISuccess($this->_entity, 'get', array(
+      'contact_id' => $this->_cId_a,
+      'relationship_type_id' => $this->_relTypeID,
+    ));
+    $this->assertEquals(1, $result['count']);
+    $result = $this->callAPISuccess($this->_entity, 'get', array(
+      'contact_id' => $this->_cId_a,
+      'relationship_type_id' => $this->_relTypeID + 1,
+    ));
+    $this->assertEquals(0, $result['count']);
+    $this->callAPISuccess($this->_entity, 'delete', array('id' => $created['id']));
+  }
+
+  /**
+   * Checks that passing in 'contact_id_b' + a relationship type
+   * will filter by relationship type for contact b
+   *
+   * We should get 1 result without or with correct relationship type id & 0 with
+   * an incorrect one
+   */
+  function testGetRelationshipByTypeDAO() {
+    $this->ids['relationship'] = $this->callAPISuccess($this->_entity, 'create', array('format.only_id' => TRUE,)  + $this->_params);
+    $result = $this->callAPISuccess($this->_entity, 'getcount', array(
+      'contact_id_a' => $this->_cId_a,),
+    1);
+    $result = $this->callAPISuccess($this->_entity, 'get', array(
+      'contact_id_a' => $this->_cId_a,
+      'relationship_type_id' => $this->_relTypeID,
+    ));
+    $this->assertEquals(1, $result['count']);
+    $result = $this->callAPISuccess($this->_entity, 'get', array(
+      'contact_id_a' => $this->_cId_a,
+      'relationship_type_id' => $this->_relTypeID + 1,
+    ));
+    $this->assertEquals(0, $result['count']);
+  }
+
+  /**
+   * Checks that passing in 'contact_id_b' + a relationship type
+   * will filter by relationship type for contact b
+   *
+   * We should get 1 result without or with correct relationship type id & 0 with
+   * an incorrect one
+   */
+  function testGetRelationshipByTypeArrayDAO() {
+    $created = $this->callAPISuccess($this->_entity, 'create', $this->_params);
+    $org3 = $this->organizationCreate();
+    $relType2 = 5; // lets just assume built in ones aren't being messed with!
+    $relType3 = 6; // lets just assume built in ones aren't being messed with!
+
+    //relationshp 2
+    $this->callAPISuccess($this->_entity, 'create',
+      array_merge($this->_params, array(
+        'relationship_type_id' => $relType2,
+        'contact_id_b' => $this->_cId_b2))
+    );
+
+    //relationshp 3
+    $this->callAPISuccess($this->_entity, 'create',
+      array_merge($this->_params, array(
+        'relationship_type_id' => $relType3,
+        'contact_id_b' => $org3))
+    );
+
+    $result = $this->callAPISuccess($this->_entity, 'get', array(
+      'contact_id_a' => $this->_cId_a,
+      'relationship_type_id' => array('IN' => array($this->_relTypeID, $relType3)),
+    ));
+
+    $this->assertEquals(2, $result['count']);
+    foreach ($result['values'] as $key => $value) {
+      $this->assertTrue(in_array($value['relationship_type_id'], array($this->_relTypeID, $relType3)));
+    }
+  }
 }
 
index 32d2bf872732f8bf671fd05b39861400d0859c8a..a0c315e0a6fe0818b7cb1e450e7605fec5e7ca0c 100644 (file)
@@ -208,7 +208,7 @@ class api_v3_RelationshipTypeTest extends CiviUnitTestCase {
    */
   function testRelationshipTypeUpdateWithoutContactType() {
     // create sample relationship type.
-    $this->_relTypeID = $this->_relationshipTypeCreate(NULL);
+    $this->_relTypeID = $this->_relationshipTypeCreate();
 
     $relTypeParams = array(
       'id' => $this->_relTypeID,
@@ -230,7 +230,7 @@ class api_v3_RelationshipTypeTest extends CiviUnitTestCase {
    */
   function testRelationshipTypeUpdate() {
     // create sample relationship type.
-    $this->_relTypeID = $this->_relationshipTypeCreate(NULL);
+    $this->_relTypeID = $this->_relationshipTypeCreate();
 
     $params = array(
       'id' => $this->_relTypeID,