From: Tim Otten Date: Tue, 6 Jan 2015 02:16:13 +0000 (-0800) Subject: CRM_Core_DAO::createTestObject() - Prefer BAO's X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2069d1b7d672a7451fc394d5de2126bf20d0d136;p=civicrm-core.git CRM_Core_DAO::createTestObject() - Prefer BAO's --- diff --git a/CRM/Core/DAO.php b/CRM/Core/DAO.php index 2b686b3ecc..ad7a213312 100644 --- a/CRM/Core/DAO.php +++ b/CRM/Core/DAO.php @@ -1604,6 +1604,13 @@ SELECT contact_id 'CRM_Financial_DAO_FinancialType'//because valid ones exist & we use pick them due to pseudoconstant can't reliably create & delete these ); + // Prefer to instantiate BAO's instead of DAO's (when possible) + // so that assignTestValue()/assignTestFK() can be overloaded. + $baoName = str_replace('_DAO_', '_BAO_', $daoName); + if (class_exists($baoName)) { + $daoName = $baoName; + } + for ($i = 0; $i < $numObjects; ++$i) { ++$counter;