Skip to content

Commit

Permalink
Fix some test cleanup routines
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Jun 24, 2023
1 parent 3e16ef5 commit 71fb8db
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions tests/phpunit/CiviTest/CiviUnitTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -1777,6 +1777,7 @@ public function quickCleanUpFinancialEntities(): void {
'civicrm_membership_block',
'civicrm_event',
'civicrm_participant',
'civicrm_payment_processor',
'civicrm_participant_payment',
'civicrm_pledge',
'civicrm_pcp_block',
Expand Down Expand Up @@ -2644,23 +2645,17 @@ protected function swapMessageTemplateForTestTemplate($templateName = 'contribut
/**
* Reinstate the default template.
*
* @param string $templateName
* @param string $type
*
* @noinspection PhpUnhandledExceptionInspection
* @noinspection PhpDocMissingThrowsInspection
*/
protected function revertTemplateToReservedTemplate(string $templateName = 'contribution_online_receipt', string $type = 'html'): void {
CRM_Core_DAO::executeQuery(
"UPDATE civicrm_option_group og
LEFT JOIN civicrm_option_value ov ON ov.option_group_id = og.id
LEFT JOIN civicrm_msg_template m ON m.workflow_id = ov.id
LEFT JOIN civicrm_msg_template m2 ON m2.workflow_id = ov.id AND m2.is_reserved = 1
SET m.msg_{$type} = m2.msg_{$type}
WHERE og.name = 'msg_tpl_workflow_contribution'
AND ov.name = '{$templateName}'
AND m.is_default = 1"
);
protected function revertTemplateToReservedTemplate(): void {
CRM_Core_DAO::executeQuery('
UPDATE civicrm_msg_template m
INNER JOIN civicrm_msg_template m2
ON m2.workflow_name = m.workflow_name AND m2.is_reserved = 1
AND m.is_default = 1
SET m.msg_html = m2.msg_html, m.msg_text = m2.msg_text
');
}

/**
Expand Down

0 comments on commit 71fb8db

Please sign in to comment.