From: Sudha Bisht Date: Fri, 10 Jul 2015 13:02:23 +0000 (+0530) Subject: Fix for test failure X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ddfe3cedc9aea1d5130f9faf7a8682d3bb37b437;p=civicrm-core.git Fix for test failure --- diff --git a/CRM/Core/BAO/Mapping.php b/CRM/Core/BAO/Mapping.php index 9ee3495819..533c14c5ba 100644 --- a/CRM/Core/BAO/Mapping.php +++ b/CRM/Core/BAO/Mapping.php @@ -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; } /** diff --git a/tests/phpunit/CRM/Core/PseudoConstantTest.php b/tests/phpunit/CRM/Core/PseudoConstantTest.php index 7433bab1eb..8c6d84ca1a 100644 --- a/tests/phpunit/CRM/Core/PseudoConstantTest.php +++ b/tests/phpunit/CRM/Core/PseudoConstantTest.php @@ -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', diff --git a/tests/phpunit/api/v3/MappingFieldTest.php b/tests/phpunit/api/v3/MappingFieldTest.php index b8adf50284..b83e5d8588 100644 --- a/tests/phpunit/api/v3/MappingFieldTest.php +++ b/tests/phpunit/api/v3/MappingFieldTest.php @@ -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,