4 * Class CRM_UF_Page_ProfileEditorTest
7 class CRM_Upgrade_Incremental_BaseTest
extends CiviUnitTestCase
{
8 use CRMTraits_Custom_CustomDataTrait
;
10 public function tearDown() {
11 $this->quickCleanup(['civicrm_saved_search']);
15 * Test message upgrade process.
17 public function testMessageTemplateUpgrade() {
18 $workFlowID = civicrm_api3('OptionValue', 'getvalue', ['return' => 'id', 'name' => 'membership_online_receipt', 'options' => ['limit' => 1, 'sort' => 'id DESC']]);
20 $templates = $this->callAPISuccess('MessageTemplate', 'get', ['workflow_id' => $workFlowID])['values'];
21 foreach ($templates as $template) {
22 $originalText = $template['msg_text'];
23 $this->callAPISuccess('MessageTemplate', 'create', ['msg_text' => 'great what a cool member you are', 'id' => $template['id']]);
24 $msg_text = $this->callAPISuccessGetValue('MessageTemplate', ['id' => $template['id'], 'return' => 'msg_text']);
25 $this->assertEquals('great what a cool member you are', $msg_text);
27 $messageTemplateObject = new CRM_Upgrade_Incremental_MessageTemplates('5.4.alpha1');
28 $messageTemplateObject->updateTemplates();
30 foreach ($templates as $template) {
31 $msg_text = $this->callAPISuccessGetValue('MessageTemplate', ['id' => $template['id'], 'return' => 'msg_text']);
32 $this->assertContains('{assign var="greeting" value="{contact.email_greeting}"}{if $greeting}{$greeting},{/if}', $msg_text);
33 if ($msg_text !== $originalText) {
34 // Reset value for future tests.
35 $this->callAPISuccess('MessageTemplate', 'create', ['msg_text' => $originalText, 'id' => $template['id']]);
41 * Test message upgrade process only edits the default if the template is customised.
43 public function testMessageTemplateUpgradeAlreadyCustomised() {
44 $workFlowID = civicrm_api3('OptionValue', 'getvalue', ['return' => 'id', 'name' => 'membership_online_receipt', 'options' => ['limit' => 1, 'sort' => 'id DESC']]);
46 $templates = $this->callAPISuccess('MessageTemplate', 'get', ['workflow_id' => $workFlowID])['values'];
47 foreach ($templates as $template) {
48 if ($template['is_reserved']) {
49 $originalText = $template['msg_text'];
50 $this->callAPISuccess('MessageTemplate', 'create', ['msg_text' => 'great what a cool member you are', 'id' => $template['id']]);
53 $this->callAPISuccess('MessageTemplate', 'create', ['msg_text' => 'great what a silly sausage you are', 'id' => $template['id']]);
56 $messageTemplateObject = new CRM_Upgrade_Incremental_MessageTemplates('5.4.alpha1');
57 $messageTemplateObject->updateTemplates();
59 foreach ($templates as $template) {
60 $msg_text = $this->callAPISuccessGetValue('MessageTemplate', ['id' => $template['id'], 'return' => 'msg_text']);
61 if ($template['is_reserved']) {
62 $this->assertContains('{assign var="greeting" value="{contact.email_greeting}"}{if $greeting}{$greeting},{/if}', $msg_text);
65 $this->assertEquals('great what a silly sausage you are', $msg_text);
68 if ($msg_text !== $originalText) {
69 // Reset value for future tests.
70 $this->callAPISuccess('MessageTemplate', 'create', ['msg_text' => $originalText, 'id' => $template['id']]);
76 * Test function for messages on upgrade.
78 public function testMessageTemplateGetUpgradeMessages() {
79 $messageTemplateObject = new CRM_Upgrade_Incremental_MessageTemplates('5.4.alpha1');
80 $messages = $messageTemplateObject->getUpgradeMessages();
82 'Memberships - Receipt (on-line)' => 'Use email greeting at top where available',
83 'Contributions - Receipt (on-line)' => 'Use email greeting at top where available',
84 'Events - Registration Confirmation and Receipt (on-line)' => 'Use email greeting at top where available',
89 * Test converting a datepicker field.
91 public function testSmartGroupDatePickerConversion() {
92 $this->callAPISuccess('SavedSearch', 'create', [
94 ['grant_application_received_date_high', '=', '01/20/2019'],
95 ['grant_due_date_low', '=', '01/22/2019'],
98 $smartGroupConversionObject = new CRM_Upgrade_Incremental_SmartGroups();
99 $smartGroupConversionObject->updateGroups([
100 'datepickerConversion' => [
101 'grant_application_received_date',
102 'grant_decision_date',
103 'grant_money_transfer_date',
107 $savedSearch = $this->callAPISuccessGetSingle('SavedSearch', []);
108 $this->assertEquals('grant_application_received_date_high', $savedSearch['form_values'][0][0]);
109 $this->assertEquals('2019-01-20 23:59:59', $savedSearch['form_values'][0][2]);
110 $this->assertEquals('grant_due_date_low', $savedSearch['form_values'][1][0]);
111 $this->assertEquals('2019-01-22 00:00:00', $savedSearch['form_values'][1][2]);
112 $hasRelative = FALSE;
113 foreach ($savedSearch['form_values'] as $form_value) {
114 if ($form_value[0] === 'grant_due_date_relative') {
118 $this->assertEquals(TRUE, $hasRelative);
122 * Test Multiple Relative Date conversions
124 public function testSmartGroupMultipleRelatvieDateConversions() {
125 $this->callAPISuccess('SavedSearch', 'create', [
127 ['membership_join_date_low', '=', '20190903000000'],
128 ['membership_join_date_high', '=', '20190903235959'],
129 ['membership_start_date_low', '=' , '20190901000000'],
130 ['membership_start_date_high', '=', '20190907235959'],
131 ['membership_end_date_low', '=', '20190901000000'],
132 ['membership_end_date_high', '=', '20190907235959'],
133 'relative_dates' => [
134 'member_join' => 'this.day',
135 'member_start' => 'this.week',
136 'member_end' => 'this.week',
140 $smartGroupConversionObject = new CRM_Upgrade_Incremental_SmartGroups();
141 $smartGroupConversionObject->updateGroups([
142 'datepickerConversion' => [
143 'membership_join_date',
144 'membership_start_date',
145 'membership_end_date',
148 $savedSearch = $this->callAPISuccessGetSingle('SavedSearch', []);
149 $this->assertContains('6', array_keys($savedSearch['form_values']));
150 $this->assertEquals('membership_join_date_relative', $savedSearch['form_values'][6][0]);
151 $this->assertEquals('this.day', $savedSearch['form_values'][6][2]);
152 $this->assertContains('7', array_keys($savedSearch['form_values']));
153 $this->assertEquals('membership_start_date_relative', $savedSearch['form_values'][7][0]);
154 $this->assertEquals('this.week', $savedSearch['form_values'][7][2]);
155 $this->assertContains('8', array_keys($savedSearch['form_values']));
156 $this->assertEquals('membership_end_date_relative', $savedSearch['form_values'][8][0]);
157 $this->assertEquals('this.week', $savedSearch['form_values'][8][2]);
161 * Test upgrading multiple Event smart groups of different formats
163 public function testMultipleEventSmartGroupDateConversions() {
164 $this->callAPISuccess('SavedSearch', 'create', [
166 ['event_start_date_low', '=', '20191001000000'],
167 ['event_end_date_high', '=', '20191031235959'],
168 'relative_dates' => [
169 'event' => 'this.month',
173 $this->callAPISuccess('SavedSearch', 'create', [
175 ['event_start_date_low', '=', '20191001000000'],
178 $this->callAPISuccess('SavedSearch', 'create', [
180 'event_start_date_low' => '20191001000000',
181 'event_end_date_high' => '20191031235959',
182 'event_relative' => 'this.month',
185 $this->callAPISuccess('SavedSearch', 'create', [
187 'event_start_date_low' => '10/01/2019',
188 'event_end_date_high' => '',
189 'event_relative' => '0',
192 $smartGroupConversionObject = new CRM_Upgrade_Incremental_SmartGroups();
193 $smartGroupConversionObject->renameFields([
194 ['old' => 'event_start_date_low', 'new' => 'event_low'],
195 ['old' => 'event_end_date_high', 'new' => 'event_high'],
197 $smartGroupConversionObject->updateGroups([
198 'datepickerConversion' => [
204 'relative_dates' => [],
205 2 => ['event_relative', '=', 'this.month'],
208 0 => ['event_low', '=', '2019-10-01 00:00:00'],
209 1 => ['event_relative', '=', 0],
212 'event_relative' => 'this.month',
215 'event_relative' => 0,
216 'event_low' => '2019-10-01 00:00:00',
219 $savedSearches = $this->callAPISuccess('SavedSearch', 'get', []);
220 foreach ($savedSearches['values'] as $id => $savedSearch) {
221 $this->assertEquals($expectedResults[$id], $savedSearch['form_values']);
226 * Test Log Date conversion
228 public function testLogDateConversion() {
229 // Create two sets of searches one set for added by and one for modified by
230 // Each set contains a relative search on this.month and a specific date search low
231 $this->callAPISuccess('SavedSearch', 'create', [
233 ['log_date', '=', 1],
234 ['log_date_low', '=', '20191001000000'],
235 ['log_date_high', '=', '20191031235959'],
236 'relative_dates' => [
237 'log' => 'this.month',
241 $this->callAPISuccess('SavedSearch', 'create', [
243 ['log_date', '=', 1],
244 ['log_date_low', '=', '20191001000000'],
247 $this->callAPISuccess('SavedSearch', 'create', [
249 ['log_date', '=', 2],
250 ['log_date_low', '=', '20191001000000'],
251 ['log_date_high', '=', '20191031235959'],
252 'relative_dates' => [
253 'log' => 'this.month',
257 $this->callAPISuccess('SavedSearch', 'create', [
259 ['log_date', '=', 2],
260 ['log_date_low', '=', '20191001000000'],
263 // On the original search form you didn't need to select the log_date radio
264 // If it wasn't selected it defaulted to created_date filtering.
265 $this->callAPISuccess('SavedSearch', 'create', [
267 ['log_date_low', '=', '20191001000000'],
268 ['log_date_high', '=', '20191031235959'],
269 'relative_dates' => [
270 'log' => 'this.month',
274 $this->callAPISuccess('SavedSearch', 'create', [
276 ['log_date_low', '=', '20191001000000'],
279 $smartGroupConversionObject = new CRM_Upgrade_Incremental_SmartGroups();
280 $smartGroupConversionObject->renameLogFields();
281 $smartGroupConversionObject->updateGroups([
282 'datepickerConversion' => [
287 $savedSearhes = $this->callAPISuccess('SavedSearch', 'get', []);
290 0 => ['log_date', '=', 1],
291 'relative_dates' => [],
292 3 => ['created_date_relative', '=', 'this.month'],
295 0 => ['log_date', '=', 1],
296 1 => ['created_date_low', '=', '2019-10-01 00:00:00'],
297 2 => ['created_date_relative', '=', 0],
300 0 => ['log_date', '=', 2],
301 'relative_dates' => [],
302 3 => ['modified_date_relative', '=', 'this.month'],
305 0 => ['log_date', '=', 2],
306 1 => ['modified_date_low', '=', '2019-10-01 00:00:00'],
307 2 => ['modified_date_relative', '=', 0],
310 'relative_dates' => [],
311 2 => ['created_date_relative', '=', 'this.month'],
314 0 => ['created_date_low', '=', '2019-10-01 00:00:00'],
315 1 => ['created_date_relative', '=', 0],
321 * Test converting relationship fields
323 public function testSmartGroupRelationshipDateConversions() {
324 $this->callAPISuccess('SavedSearch', 'create', [
326 ['relationship_start_date_low', '=', '20191001000000'],
327 ['relationship_start_date_high', '=', '20191031235959'],
328 ['relationship_end_date_low', '=', '20191001000000'],
329 ['relationship_end_date_high', '=', '20191031235959'],
330 'relative_dates' => [
331 'relation_start' => 'this.month',
332 'relation_end' => 'this.month',
336 $smartGroupConversionObject = new CRM_Upgrade_Incremental_SmartGroups();
337 $smartGroupConversionObject->updateGroups([
338 'datepickerConversion' => [
339 'relationship_start_date',
340 'relationship_end_date',
343 $savedSearch = $this->callAPISuccessGetSingle('SavedSearch', []);
344 $this->assertEquals([], $savedSearch['form_values']['relative_dates']);
345 $this->assertEquals(['relationship_start_date_relative', '=', 'this.month'], $savedSearch['form_values'][4]);
346 $this->assertEquals(['relationship_end_date_relative', '=', 'this.month'], $savedSearch['form_values'][5]);
350 * Test convert custom saved search
352 public function testSmartGroupCustomDateRangeSearch() {
353 $this->entity
= 'Contact';
354 $this->createCustomGroupWithFieldOfType([], 'date');
355 $dateCustomFieldName = $this->getCustomFieldName('date');
356 $this->callAPISuccess('SavedSearch', 'create', [
358 [$dateCustomFieldName . '_relative', '=', 0],
359 [$dateCustomFieldName, '=', ['BETWEEN' => ['20191001000000', '20191031235959']]],
362 $this->callAPISuccess('SavedSearch', 'create', [
364 [$dateCustomFieldName . '_relative', '=', 0],
365 [$dateCustomFieldName, '=', ['>=' => '20191001000000']],
368 $this->callAPISuccess('SavedSearch', 'create', [
370 [$dateCustomFieldName . '_relative', '=', 0],
371 [$dateCustomFieldName, '=', ['<=' => '20191031235959']],
374 $this->callAPISuccess('SavedSearch', 'create', [
376 [$dateCustomFieldName . '_relative', '=', 'this.month'],
379 $smartGroupConversionObject = new CRM_Upgrade_Incremental_SmartGroups();
380 $smartGroupConversionObject->convertCustomSmartGroups();
383 0 => [$dateCustomFieldName . '_relative', '=', 0],
384 2 => [$dateCustomFieldName . '_low', '=', '2019-10-01 00:00:00'],
385 3 => [$dateCustomFieldName . '_high', '=', '2019-10-31 23:59:59'],
388 0 => [$dateCustomFieldName . '_relative', '=', 0],
389 2 => [$dateCustomFieldName . '_low', '=', '2019-10-01 00:00:00'],
392 0 => [$dateCustomFieldName . '_relative', '=', 0],
393 2 => [$dateCustomFieldName . '_high', '=', '2019-10-31 23:59:59'],
396 0 => [$dateCustomFieldName . '_relative', '=', 'this.month'],
399 $savedSearches = $this->callAPISuccess('SavedSearch', 'get', []);
400 foreach ($savedSearches['values'] as $id => $savedSearch) {
401 $this->assertEquals($expectedResults[$id], $savedSearch['form_values']);
406 * Test conversion of on hold group.
408 public function testOnHoldConversion() {
409 $this->callAPISuccess('SavedSearch', 'create', [
411 ['on_hold', '=', '1'],
414 $smartGroupConversionObject = new CRM_Upgrade_Incremental_SmartGroups('5.11.alpha1');
415 $smartGroupConversionObject->convertEqualsStringToInArray('on_hold');
416 $savedSearch = $this->callAPISuccessGetSingle('SavedSearch', []);
417 $this->assertEquals('IN', $savedSearch['form_values'][0][1]);
418 $this->assertEquals(['1'], $savedSearch['form_values'][0][2]);
423 * Test renaming a field.
425 public function testRenameField() {
426 $this->callAPISuccess('SavedSearch', 'create', [
428 ['activity_date_low', '=', '01/22/2019'],
431 $smartGroupConversionObject = new CRM_Upgrade_Incremental_SmartGroups();
432 $smartGroupConversionObject->renameField('activity_date_low', 'activity_date_time_low');
433 $savedSearch = $this->callAPISuccessGetSingle('SavedSearch', []);
434 $this->assertEquals('activity_date_time_low', $savedSearch['form_values'][0][0]);
438 * Test renaming multiple fields.
442 public function testRenameFields() {
443 $this->callAPISuccess('SavedSearch', 'create', [
445 ['activity_date_low', '=', '01/22/2019'],
446 ['activity_date_relative', '=', 0],
449 $smartGroupConversionObject = new CRM_Upgrade_Incremental_SmartGroups();
450 $smartGroupConversionObject->renameFields([
451 ['old' => 'activity_date_low', 'new' => 'activity_date_time_low'],
452 ['old' => 'activity_date_relative', 'new' => 'activity_date_time_relative'],
454 $savedSearch = $this->callAPISuccessGetSingle('SavedSearch', []);
455 $this->assertEquals('activity_date_time_low', $savedSearch['form_values'][0][0]);
456 $this->assertEquals('activity_date_time_relative', $savedSearch['form_values'][1][0]);
460 * Test that a mis-saved variable in 'contribute settings' can be converted to a
463 public function testConvertUpgradeContributeSettings() {
465 'deferred_revenue_enabled' => 1,
466 'invoice_prefix' => 'G_',
467 'credit_notes_prefix' => 'XX_',
469 'due_date_period' => 'weeks',
470 'notes' => '<p>Give me money</p>',
471 'tax_term' => 'Extortion',
472 'tax_display_settings' => 'Exclusive',
474 CRM_Core_DAO
::executeQuery("INSERT INTO civicrm_setting (name, domain_id, value)
475 VALUES ('contribution_invoice_settings', 1, '" . serialize($setting) . "')");
476 CRM_Upgrade_Incremental_Base
::updateContributeSettings(NULL, 5.1);
477 $this->assertEquals(1, Civi
::settings()->get('deferred_revenue_enabled'));
478 $this->assertEquals('G_', Civi
::settings()->get('invoice_prefix'));
479 $this->assertEquals('XX_', Civi
::settings()->get('credit_notes_prefix'));
480 $this->assertEquals('20', Civi
::settings()->get('invoice_due_date'));
481 $this->assertEquals('weeks', Civi
::settings()->get('invoice_due_date_period'));
482 $this->assertEquals('<p>Give me money</p>', Civi
::settings()->get('invoice_notes'));
483 $this->assertEquals('Extortion', Civi
::settings()->get('tax_term'));
484 $this->assertEquals('Exclusive', Civi
::settings()->get('tax_display_settings'));
488 * dev/core#1405 Test fixing option groups with spaces in the name
490 public function testFixOptionGroupName() {
491 $name = 'This is a test Name';
492 $fixedName = CRM_Utils_String
::titleToVar(strtolower($name));
493 $optionGroup = $this->callAPISuccess('OptionGroup', 'create', [
494 'title' => 'Test Option Group',
497 // API is hardened to strip the spaces to lets re-add in now
498 CRM_Core_DAO
::executeQuery("UPDATE civicrm_option_group SET name = %1 WHERE id = %2", [
499 1 => [$name, 'String'],
500 2 => [$optionGroup['id'], 'Positive'],
502 $preUpgrade = $this->callAPISuccess('OptionGroup', 'getsingle', ['id' => $optionGroup['id']]);
503 $this->assertEquals($name, $preUpgrade['name']);
504 CRM_Upgrade_Incremental_php_FiveTwentyOne
::fixOptionGroupName();
505 $postUpgrade = $this->callAPISuccess('OptionGroup', 'getsingle', ['id' => $optionGroup['id']]);
506 $this->assertEquals($fixedName, $postUpgrade['name'], 'Ensure that the spaces have been removed from OptionGroup name');
507 $this->assertEquals($postUpgrade['name'], $optionGroup['values'][$optionGroup['id']]['name'], 'Ensure that the fixed name matches what the API would produce');
508 $this->callAPISuccess('OptionGroup', 'delete', ['id' => $optionGroup['id']]);
512 * Test that if there is an option group name as the same as the proposed fix name that doesn't cause a hard fail in the upgrade
514 public function testFixOptionGroupNameWithFixedNameInDatabase() {
515 $name = 'This is a test Name';
516 $fixedName = CRM_Utils_String
::titleToVar(strtolower($name));
517 $optionGroup = $this->callAPISuccess('OptionGroup', 'create', [
518 'title' => 'Test Option Group',
521 // API is hardened to strip the spaces to lets re-add in now
522 CRM_Core_DAO
::executeQuery("UPDATE civicrm_option_group SET name = %1 WHERE id = %2", [
523 1 => [$name, 'String'],
524 2 => [$optionGroup['id'], 'Positive'],
526 $optionGroup2 = $this->callAPISuccess('OptionGroup', 'create', [
527 'title' => 'Test Option Group 2',
530 $preUpgrade = $this->callAPISuccess('OptionGroup', 'getsingle', ['id' => $optionGroup['id']]);
531 $this->assertEquals($name, $preUpgrade['name']);
532 $preUpgrade = $this->callAPISuccess('OptionGroup', 'getsingle', ['id' => $optionGroup2['id']]);
533 $this->assertEquals($fixedName, $preUpgrade['name']);
534 CRM_Upgrade_Incremental_php_FiveTwentyOne
::fixOptionGroupName();
535 $this->callAPISuccess('OptionGroup', 'delete', ['id' => $optionGroup['id']]);
536 $this->callAPISuccess('OptionGroup', 'delete', ['id' => $optionGroup2['id']]);
540 * Test conversion between jcalendar and datepicker in reports
542 public function testReportFormConvertDatePicker() {
543 $report = $this->callAPISuccess('ReportInstance', 'create', [
544 'report_id' => 'contribute/detail',
550 'financial_type_id' => 1,
555 'sort_name_op' => 'has',
556 'sort_name_value' => '',
561 'contact_type_op' => 'in',
562 'contact_type_value' => [],
563 'contact_sub_type_op' => 'in',
564 'contact_sub_type_value' => [],
565 'is_deleted_op' => 'eq',
566 'is_deleted_value' => 0,
567 'preferred_language_op' => 'in',
568 'preferred_language_value' => [],
569 'do_not_email_op' => 'eq',
570 'do_not_email_value' => '',
571 'do_not_phone_op' => 'eq',
572 'do_not_phone_value' => '',
573 'do_not_mail_op' => 'eq',
574 'do_not_mail_value' => '',
575 'do_not_sms_op' => 'eq',
576 'do_not_sms_value' => '',
577 'is_opt_out_op' => 'eq',
578 'is_opt_out_value' => '',
579 'first_name_op' => 'has',
580 'first_name_value' => '',
581 'prefix_id_op' => 'in',
582 'prefix_id_value' => [],
583 'suffix_id_op' => 'in',
584 'suffix_id_value' => [],
585 'gender_id_op' => 'in',
586 'gender_id_value' => [],
587 'birth_date_relative' => '',
588 'birth_date_from' => '',
589 'birth_date_to' => '',
590 'is_deceased_op' => 'eq',
591 'is_deceased_value' => '',
592 'contribution_or_soft_op' => 'eq',
593 'contribution_or_soft_value' => 'contributions_only',
594 'receive_date_relative' => 0,
595 'receive_date_from' => '11/01/1991',
596 'receive_date_to' => '',
597 'thankyou_date_relative' => '',
598 'thankyou_date_from' => '',
599 'thankyou_date_to' => '',
600 'contribution_source_op' => 'has',
601 'contribution_source_value' => '',
602 'currency_op' => 'in',
603 'currency_value' => [],
604 'non_deductible_amount_min' => '',
605 'non_deductible_amount_max' => '',
606 'non_deductible_amount_op' => 'lte',
607 'non_deductible_amount_value' => '',
608 'financial_type_id_op' => 'in',
609 'financial_type_id_value' => [],
610 'contribution_page_id_op' => 'in',
611 'contribution_page_id_value' => [],
612 'payment_instrument_id_op' => 'in',
613 'payment_instrument_id_value' => [],
614 'contribution_status_id_op' => 'in',
615 'contribution_status_id_value' => [0 => 1],
616 'total_amount_min' => '',
617 'total_amount_max' => '',
618 'total_amount_op' => 'lte',
619 'total_amount_value' => '',
620 'cancel_date_relative' => '',
621 'cancel_date_from' => '',
622 'cancel_date_to' => '',
623 'cancel_reason_op' => 'has',
624 'cancel_reason_value' => '',
625 'soft_credit_type_id_op' => 'in',
626 'soft_credit_type_id_value' => [],
627 'card_type_id_op' => 'in',
628 'card_type_id_value' => [],
629 'ordinality_op' => 'in',
630 'ordinality_value' => [],
632 'street_address_op' => 'has',
633 'street_address_value' => '',
634 'postal_code_op' => 'has',
635 'postal_code_value' => '',
638 'country_id_op' => 'in',
639 'country_id_value' => [],
640 'state_province_id_op' => 'in',
641 'state_province_id_value' => [],
642 'county_id_op' => 'in',
643 'county_id_value' => [],
648 'group_bys' => ['contribution_id' => 1],
651 'column' => 'sort_name',
655 'description' => 'Lists specific contributions by criteria including contact, time period, contribution type, contributor location, etc. Contribution summary report points to this report for contribution details.',
656 'email_subject' => '',
660 'view_mode' => 'criteria',
661 'cache_minutes' => 60,
662 'permission' => 'access CiviContribute',
666 'report_id' => 'contribute/detail',
668 'title' => 'test Report',
670 CRM_Upgrade_Incremental_php_FiveTwentyFive
::convertReportsJcalendarToDatePicker();
671 $reportGet = $this->callAPISuccess('ReportInstance', 'getsingle', ['id' => $report['id']]);
672 $formValues = unserialize($reportGet['form_values']);
673 $this->assertEquals('1991-11-01 00:00:00', $formValues['receive_date_from']);
676 public function testUpdateContactTypeNameField() {
677 CRM_Core_DAO
::executeQuery("INSERT INTO civicrm_contact_type (name,label,parent_id, is_active) VALUES ('', 'Test Contact Type', 1, 1)");
678 CRM_Upgrade_Incremental_php_FiveTwentyEight
::populateMissingContactTypeName();
679 $contactType = $this->callAPISuccess('ContactType', 'getsingle', ['label' => 'Test Contact Type']);
680 $this->assertNotEmpty($contactType['name']);
681 $this->callAPISuccess('ContactType', 'delete', ['id' => $contactType['id']]);