From 637ea2cfd04dcd7ab59fd08c9c499c5bde7aed4b Mon Sep 17 00:00:00 2001 From: Eileen Date: Fri, 3 Jan 2014 18:51:41 +1300 Subject: [PATCH] ManagedEntities e-notice fix - as exposed by test getsingle will not have an 'is_error' on success --- CRM/Core/ManagedEntities.php | 10 +++++----- tests/phpunit/CRM/Core/ManagedEntitiesTest.php | 4 ---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/CRM/Core/ManagedEntities.php b/CRM/Core/ManagedEntities.php index 1c0c565555..bd053f6e30 100644 --- a/CRM/Core/ManagedEntities.php +++ b/CRM/Core/ManagedEntities.php @@ -50,15 +50,15 @@ class CRM_Core_ManagedEntities { $dao->name = $name; if ($dao->find(TRUE)) { $params = array( - 'version' => 3, 'id' => $dao->entity_id, ); - $result = civicrm_api($dao->entity_type, 'getsingle', $params); - if ($result['is_error']) { + try { + $result = civicrm_api3($dao->entity_type, 'getsingle', $params); + } + catch (Exception $e) { $this->onApiError($params, $result); - } else { - return $result; } + return $result; } else { return NULL; } diff --git a/tests/phpunit/CRM/Core/ManagedEntitiesTest.php b/tests/phpunit/CRM/Core/ManagedEntitiesTest.php index ff7b704e48..bd0b997953 100644 --- a/tests/phpunit/CRM/Core/ManagedEntitiesTest.php +++ b/tests/phpunit/CRM/Core/ManagedEntitiesTest.php @@ -3,10 +3,6 @@ require_once 'CiviTest/CiviUnitTestCase.php'; class CRM_Core_ManagedEntitiesTest extends CiviUnitTestCase { - //@todo make BAO enotice compliant & remove the line below - // WARNING - NEVER COPY & PASTE $_eNoticeCompliant = FALSE - // new test classes should be compliant. - public $_eNoticeCompliant = FALSE; function get_info() { return array( 'name' => 'ManagedEntities', -- 2.25.1