Fix for test failure
authorSudha Bisht <sudha.bisht@webaccessglobal.com>
Fri, 10 Jul 2015 13:02:23 +0000 (18:32 +0530)
committerSudha Bisht <sudha.bisht@webaccessglobal.com>
Thu, 10 Dec 2015 08:12:36 +0000 (13:42 +0530)
CRM/Core/BAO/Mapping.php
tests/phpunit/CRM/Core/PseudoConstantTest.php
tests/phpunit/api/v3/MappingFieldTest.php

index 9ee349581973c339a223b950bbc2486a0fbd584b..533c14c5baffe75e7ff654b132b02c5ba9b22356 100644 (file)
@@ -80,10 +80,12 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping {
     // delete from mapping table
     $mapping = new CRM_Core_DAO_Mapping();
     $mapping->id = $id;
-    $mapping->delete();
-    CRM_Core_Session::setStatus(ts('Selected mapping has been deleted successfully.'), ts('Deleted'), 'success');
-
-    return TRUE;
+    if ($mapping->find(TRUE)) {
+      $result = $mapping->delete();
+      CRM_Core_Session::setStatus(ts('Selected mapping has been deleted successfully.'), ts('Deleted'), 'success');
+      return $result;
+    }
+    return FALSE;
   }
 
   /**
index 7433bab1eb702af07bfe24e9f5f59d554474fe03..8c6d84ca1a33558651488991481c81e90d48b006 100644 (file)
@@ -693,10 +693,6 @@ class CRM_Core_PseudoConstantTest extends CiviUnitTestCase {
         ),
       ),
       'CRM_Core_DAO_MappingField' => array(
-        array(
-          'fieldName' => 'contact_type',
-          'sample' => 'Individual',
-        ),
         array(
           'fieldName' => 'website_type_id',
           'sample' => 'Facebook',
index b8adf5028430e49916595fb811830c4f0973e499..b83e5d8588f9c348212dd367483127106844e708 100644 (file)
@@ -48,9 +48,9 @@ class api_v3_MappingFieldTest extends CiviUnitTestCase {
     $this->useTransaction(TRUE);
 
     $this->_entity = 'mapping_field';
-    $this->_mappingID = $this->mappingCreate();
+    $mappingID = $this->mappingCreate();
     $this->params = array(
-      'mapping_id' => $this->_mappingID,
+      'mapping_id' => $mappingID->id,
       'name' => 'last_name',
       'contact_type' => 'Individual',
       'column_number' => 2,