Skip to content
Snippets Groups Projects
Commit 5c1174d3 authored by colemanw's avatar colemanw
Browse files

CRM-13807 - Add comments and null test

parent 6bcc2df3
Branches
No related tags found
No related merge requests found
......@@ -307,8 +307,12 @@ function _civicrm_api3_get_DAO($name) {
*/
function _civicrm_api3_get_BAO($name) {
$dao = _civicrm_api3_get_DAO($name);
if (!$dao) {
return NULL;
}
$bao = str_replace("DAO", "BAO", $dao);
$file = strtr($bao, '_', '/') . '.php';
// Check if this entity actually has a BAO. Fall back on the DAO if not.
return stream_resolve_include_path($file) ? $bao : $dao;
}
......
......@@ -201,6 +201,8 @@ class api_v3_UtilsTest extends CiviUnitTestCase {
'Household' => 'CRM_Contact_BAO_Contact',
// Note this one DOES NOT have a BAO so we expect to fall back on returning the DAO
'mailing_group' => 'CRM_Mailing_DAO_MailingGroup',
// Make sure we get null back with nonexistant entities
'civicrm_this_does_not_exist' => NULL,
);
foreach ($params as $input => $expected) {
$result = _civicrm_api3_get_BAO($input);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment