2 // This file is part of Moodle - http://moodle.org/
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 * Fixtures for task tests.
22 * @copyright 2014 Petr Skoda
23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
27 defined('MOODLE_INTERNAL') ||
die();
32 * @copyright 2022 Catalyst IT Australia Pty Ltd
33 * @author Cameron Ball <cameron@cameron1729.xyz>
34 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
36 class adhoc_test_task
extends \core\task\adhoc_task
{
41 * @param int|null $nextruntime Next run time
42 * @param int|null $timestarted Time started
44 public function __construct(?
int $nextruntime = null, ?
int $timestarted = null) {
46 $this->set_next_run_time($nextruntime);
50 $this->set_timestarted($timestarted);
59 public function get_name() {
60 return 'Test adhoc class';
66 public function execute() {
73 * @copyright 2022 Catalyst IT Australia Pty Ltd
74 * @author Cameron Ball <cameron@cameron1729.xyz>
75 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
77 class adhoc_test2_task
extends adhoc_test_task
{
83 * @copyright 2022 Catalyst IT Australia Pty Ltd
84 * @author Cameron Ball <cameron@cameron1729.xyz>
85 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
87 class adhoc_test3_task
extends adhoc_test_task
{
93 * @copyright 2022 Catalyst IT Australia Pty Ltd
94 * @author Cameron Ball <cameron@cameron1729.xyz>
95 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
97 class adhoc_test4_task
extends adhoc_test_task
{
103 * @copyright 2022 Catalyst IT Australia Pty Ltd
104 * @author Cameron Ball <cameron@cameron1729.xyz>
105 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
107 class adhoc_test5_task
extends adhoc_test_task
{
110 class scheduled_test_task
extends \core\task\scheduled_task
{
111 public function get_name() {
115 public function execute() {
119 class scheduled_test2_task
extends \core\task\scheduled_task
{
120 public function get_name() {
121 return "Test task 2";
124 public function execute() {
128 class scheduled_test3_task
extends \core\task\scheduled_task
{
129 public function get_name() {
130 return "Test task 3";
133 public function execute() {
137 namespace mod_fake\task
;
139 class adhoc_component_task
extends \core\task\adhoc_task
{
140 public function execute() {