Skip to content

Commit

Permalink
[php8-compat] Partial Fix of hook tests for php8
Browse files Browse the repository at this point in the history
  • Loading branch information
seamuslee001 committed Jun 8, 2021
1 parent a91e37d commit 6514beb
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CRM/Contact/Page/DedupeMerge.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public static function getRunner() {
* @throws \CiviCRM_API3_Exception
* @throws \API_Exception
*/
public static function callBatchMerge(CRM_Queue_TaskContext $ctx, $rgid, $gid, $mode = 'safe', $batchLimit, $isSelected, $criteria, $searchLimit) {
public static function callBatchMerge(CRM_Queue_TaskContext $ctx, $rgid, $gid, $mode, $batchLimit, $isSelected, $criteria, $searchLimit) {
CRM_Dedupe_Merger::batchMerge($rgid, $gid, $mode, $batchLimit, $isSelected, $criteria, TRUE, FALSE, $searchLimit);
return CRM_Queue_Task::TASK_SUCCESS;
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Event/Page/ManageEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ public function search() {
*
* @return string
*/
public function whereClause(&$params, $sortBy = TRUE, $force) {
public function whereClause(&$params, $sortBy, $force) {
$values = [];
$clauses = [];
$title = $this->get('title');
Expand Down
2 changes: 1 addition & 1 deletion templates/CRM/Admin/Form/ContactType.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</tr>
<tr class="crm-contact-type-form-block-parent_id">
<td class="label">{$form.parent_id.label}</td>
{if $is_parent OR $action EQ 1}
{if !empty($is_parent) OR $action EQ 1}
<td>{$form.parent_id.html}</td>
{else}
<td>{ts}{$contactTypeName}{/ts} {ts}(built-in){/ts}</td>
Expand Down
4 changes: 4 additions & 0 deletions templates/CRM/Admin/Form/OptionGroup.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
<td class="label">{$form.description.label}
{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_option_group' field='description' id=$id}{/if}</td><td>{$form.description.html}</td>
</tr>
{if !empty($form.name)}
<td class="label">{$form.name.label}</td>
<td>{$form.name.html}</td></tr>
{/if}
<tr class="crm-admin-optiongroup-form-block-data-type">
<td class="label">{$form.data_type.label}</td>
<td>{$form.data_type.html}</td>
Expand All @@ -36,10 +38,12 @@
<td class="label">{$form.is_active.label}</td>
<td>{$form.is_active.html}</td>
</tr>
{if !empty($form.is_reserved)}
<tr class="crm-admin-optiongroup-form-block-is_reserved">
<td class="label">{$form.is_reserved.label}</td>
<td>{$form.is_reserved.html}</td>
</tr>
{/if}
</table>
{/if}
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
Expand Down
24 changes: 13 additions & 11 deletions templates/CRM/Admin/Form/Options.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,22 @@
<span class="description">{ts}A "string value" or regular expression to be redacted (replaced).{/ts}</span>
</td>
</tr>
{else}
{elseif !empty($form.label)}
<tr class="crm-admin-options-form-block-label">
<td class="label">{$form.label.label} {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_option_value' field='label' id=$id}{/if}</td>
<td class="html-adjust">{$form.label.html}<br />
<span class="description">{ts}The option label is displayed to users.{/ts}</span>
</td>
</tr>
{if $form.financial_account_id.html}
{if !empty($form.financial_account_id.html)}
<tr class="crm-admin-options-form-block-grouping">
<td class="label">{$form.financial_account_id.label}</td>
<td>{$form.financial_account_id.html}</td>
</tr>
{/if}
{/if}

{if $form.value.html && $gName neq 'redaction_rule'}
{if !empty($form.value.html) && $gName neq 'redaction_rule'}
<tr class="crm-admin-options-form-block-value">
<td class="label">{$form.value.label}</td>
<td>{$form.value.html}<br />
Expand All @@ -80,15 +80,15 @@
</td>
</tr>
{/if}
{if $form.name.html} {* Get the name value also *}
{if !empty($form.name.html)} {* Get the name value also *}
<tr class="crm-admin-options-form-block-name">
<td class="label">{$form.name.label}</td>
<td>{$form.name.html}<br />
<span class="description">{ts}The class name which implements this functionality.{/ts}</span>
</td>
</tr>
{/if}
{if $form.filter.html} {* Filter property is only exposed for some option groups. *}
{if !empty($form.filter.html)} {* Filter property is only exposed for some option groups. *}
<tr class="crm-admin-options-form-block-filter">
<td class="label">{$form.filter.label}</td>
<td>{$form.filter.html}</td>
Expand All @@ -109,29 +109,31 @@
<td>{$form.visibility_id.html}</td>
</tr>
{/if}
{if $form.grouping.html}
{if !empty($form.grouping.html)}
<tr class="crm-admin-options-form-block-grouping">
<td class="label">{$form.grouping.label}</td>
<td>{$form.grouping.html}</td>
</tr>
{/if}
{if !empty($form.weight)}
<tr class="crm-admin-options-form-block-weight">
<td class="label">{$form.weight.label}</td>
<td>{$form.weight.html}</td>
</tr>
{if $form.icon.html}
{/if}
{if !empty($form.icon.html)}
<tr class="crm-admin-options-form-block-icon">
<td class="label">{$form.icon.label}</td>
<td>{$form.icon.html}</td>
</tr>
{/if}
{if $form.color.html}
{if !empty($form.color.html)}
<tr class="crm-admin-options-form-block-color">
<td class="label">{$form.color.label}</td>
<td>{$form.color.html}</td>
</tr>
{/if}
{if $form.component_id.html} {* Component ID is exposed for activity types if CiviCase is enabled. *}
{if !empty($form.component_id.html)} {* Component ID is exposed for activity types if CiviCase is enabled. *}
<tr class="crm-admin-options-form-block-component_id">
<td class="label">{$form.component_id.label}</td>
<td>{$form.component_id.html}</td>
Expand All @@ -141,13 +143,13 @@
<td class="label">{$form.is_active.label}</td>
<td>{$form.is_active.html}</td>
</tr>
{if $showDefault}
{if !empty($showDefault)}
<tr class="crm-admin-options-form-block-is_default">
<td class="label">{$form.is_default.label}</td>
<td>{$form.is_default.html}</td>
</tr>
{/if}
{if $showContactFilter}{* contactOptions is exposed for email/postal greeting and addressee types to set filter for contact types *}
{if !empty($showContactFilter)}{* contactOptions is exposed for email/postal greeting and addressee types to set filter for contact types *}
<tr class="crm-admin-options-form-block-contactOptions">
<td class="label">{$form.contactOptions.label}</td>
<td>{$form.contactOptions.html}</td>
Expand Down
3 changes: 3 additions & 0 deletions tests/phpunit/CRM/Core/Page/HookTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ public function setUp(): void {
$items = CRM_Core_Menu::items(TRUE);
// Check if they extend the class we care about; test if needed.
foreach ($items as $item) {
if (!isset($item['page_callback'])) {
continue;
}
$class = is_array($item['page_callback']) ? $item['page_callback'][0] : $item['page_callback'];
if (in_array($class, $this->skip)) {
continue;
Expand Down

0 comments on commit 6514beb

Please sign in to comment.