Skip to content

Commit

Permalink
MDL-69099 tasks: Do not mark the non-enabled plugin's task as disabled
Browse files Browse the repository at this point in the history
The `core\plugininfo\base::is_enabled()` uses three-state logic for its
return value. It can return null as a valid value as per its
documentation. We need to test for the explicit false value in this
case.

To make the attached Behat test able to identify the table, the caption
is added. It seems to be helpful for all users so I leave it displayed
without using the accesshide mechanism.
  • Loading branch information
mudrd8mz authored and vmdef committed Jun 22, 2020
1 parent 680502e commit cdcb53a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion admin/tool/task/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public function scheduled_tasks_table($tasks, $lastchanged = '') {
$showloglink = \core\task\logmanager::has_log_report();

$table = new html_table();
$table->caption = get_string('scheduledtasks', 'tool_task');
$table->head = [
get_string('name'),
get_string('component', 'tool_task'),
Expand Down Expand Up @@ -180,7 +181,7 @@ public function component_name(string $component): string {
$plugininfo->init_display_name();

$componentname = $plugininfo->displayname;
if (!$plugininfo->is_enabled()) {
if ($plugininfo->is_enabled() === false) {
$componentname .= ' ' . html_writer::span(
get_string('disabled', 'tool_task'), 'badge badge-secondary');
}
Expand Down
6 changes: 6 additions & 0 deletions admin/tool/task/tests/behat/manage_tasks.feature
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,9 @@ Feature: Manage scheduled tasks
| Name | Component | Minute | Hour | Day | Day of week | Month |
| Log table cleanup | Standard log | */5 | 1 | 2 | 4 | 3 |
And I should see "Log table cleanup" in the "tr.table-primary" "css_element"

Scenario: Disabled plugin's tasks are labelled as disabled too
When "CAS users sync job \auth_cas\task\sync_task" row "Next run" column of "Scheduled tasks" table should contain "Plugin disabled"
Then "CAS users sync job \auth_cas\task\sync_task" row "Component" column of "Scheduled tasks" table should contain "Disabled"
And "Background processing for scheduled allocation \workshopallocation_scheduled\task\cron_task" row "Next run" column of "Scheduled tasks" table should not contain "Plugin disabled"
And "Background processing for scheduled allocation \workshopallocation_scheduled\task\cron_task" row "Component" column of "Scheduled tasks" table should not contain "Disabled"

0 comments on commit cdcb53a

Please sign in to comment.