From 50b39b5b34c497a9b9a06f44510dea6a8511916b Mon Sep 17 00:00:00 2001 From: priyankakaran26 Date: Thu, 11 Sep 2014 13:49:40 +0100 Subject: [PATCH] towards recurring activity test case --- CRM/Core/BAO/RecurringEntity.php | 7 ++++--- tests/phpunit/CRM/Core/BAO/RecurringEntityTest.php | 9 +++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/CRM/Core/BAO/RecurringEntity.php b/CRM/Core/BAO/RecurringEntity.php index 5213e94985..64f7b994c8 100644 --- a/CRM/Core/BAO/RecurringEntity.php +++ b/CRM/Core/BAO/RecurringEntity.php @@ -39,11 +39,12 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity { static $_tableDAOMapper = array( - 'civicrm_event' => 'CRM_Event_DAO_Event', + 'civicrm_event' => 'CRM_Event_DAO_Event', 'civicrm_price_set_entity' => 'CRM_Price_DAO_PriceSetEntity', 'civicrm_uf_join' => 'CRM_Core_DAO_UFJoin', 'civicrm_tell_friend' => 'CRM_Friend_DAO_Friend', 'civicrm_pcp_block' => 'CRM_PCP_DAO_PCPBlock', + 'civicrm_activity' => 'CRM_Activity_DAO_Activity', ); static function add(&$params) { @@ -215,6 +216,8 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity { $updateDAO = CRM_Core_DAO::cascadeUpdate($daoName, $obj->id, $entityID, $skipData); CRM_Core_DAO::freeResult(); + } else { + CRM_Core_Error::fatal("DAO Mapper missing for $entityTable."); } } // done with processing. lets unset static var. @@ -471,7 +474,6 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity { } return $recursionResult; } - static public function delEntityRelations($entityId, $entityTable){ if(!$entityId && !$entityTable){ @@ -507,5 +509,4 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity { } return $participantDetails; } - } diff --git a/tests/phpunit/CRM/Core/BAO/RecurringEntityTest.php b/tests/phpunit/CRM/Core/BAO/RecurringEntityTest.php index 52ad85fa89..c55fb6df3d 100644 --- a/tests/phpunit/CRM/Core/BAO/RecurringEntityTest.php +++ b/tests/phpunit/CRM/Core/BAO/RecurringEntityTest.php @@ -25,9 +25,8 @@ +--------------------------------------------------------------------+ */ - - require_once 'CiviTest/CiviUnitTestCase.php'; +require_once "CRM/Core/BAO/RecurringEntity.php"; /** * Class CRM_Event_BAO_RecurringEntityTest @@ -63,7 +62,6 @@ class CRM_Event_BAO_RecurringEntityTest extends CiviUnitTestCase { * add() method for RecurringEntity */ function testAdd() { - require_once "CRM/Core/BAO/RecurringEntity.php"; if( $this->_parentID ){ //Add parent to civicrm_recurring_entity table $newCreatedParentID = CRM_Core_BAO_RecurringEntity::quickAdd($this->_parentID, $this->_parentID, 'civicrm_activity'); @@ -132,8 +130,7 @@ class CRM_Event_BAO_RecurringEntityTest extends CiviUnitTestCase { } } - public static function testModifyEntity() { - require_once "CRM/Core/BAO/RecurringEntity.php"; + function testModifyEntity() { /** * Lets modify an activity and see if other related activities get cascaded */ @@ -164,4 +161,4 @@ class CRM_Event_BAO_RecurringEntityTest extends CiviUnitTestCase { } - \ No newline at end of file + -- 2.25.1