Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
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.
8
//
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.
13
//
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/>.
16
 
17
/**
18
 * Fixtures for task tests.
19
 *
20
 * @package    core
21
 * @category   phpunit
22
 * @copyright  2014 Petr Skoda
23
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24
 */
25
 
26
namespace core\task;
27
defined('MOODLE_INTERNAL') || die();
28
 
29
/**
30
 * Test class.
31
 *
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
35
 */
36
class adhoc_test_task extends \core\task\adhoc_task {
37
 
38
    /**
39
     * Constructor.
40
     *
41
     * @param int|null $nextruntime Next run time
42
     * @param int|null $timestarted Time started
43
     */
44
    public function __construct(?int $nextruntime = null, ?int $timestarted = null) {
45
        if ($nextruntime) {
46
            $this->set_next_run_time($nextruntime);
47
        }
48
 
49
        if ($timestarted) {
50
            $this->set_timestarted($timestarted);
51
        }
52
    }
53
 
54
    /**
55
     * Get task name
56
     *
57
     * @return string
58
     */
59
    public function get_name() {
60
        return 'Test adhoc class';
61
    }
62
 
63
    /**
64
     * Execute.
65
     */
66
    public function execute() {
67
    }
68
}
69
 
70
/**
71
 * Test class.
72
 *
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
76
 */
77
class adhoc_test2_task extends adhoc_test_task {
78
}
79
 
80
/**
81
 * Test class.
82
 *
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
86
 */
87
class adhoc_test3_task extends adhoc_test_task {
88
}
89
 
90
/**
91
 * Test class.
92
 *
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
96
 */
97
class adhoc_test4_task extends adhoc_test_task {
98
}
99
 
100
/**
101
 * Test class.
102
 *
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
106
 */
107
class adhoc_test5_task extends adhoc_test_task {
108
}
109
 
110
/**
111
 * Test class for no-retry adhoc task.
112
 *
113
 * @package    core
114
 * @copyright  2023 Huong Nguyen <huongnv13@gmail.com>
115
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
116
 */
117
class no_retry_adhoc_task extends adhoc_test_task {
118
 
119
    /**
120
     * Prevent the task from retrying.
121
     * @return bool
122
     */
123
    public function retry_until_success(): bool {
124
        return false;
125
    }
126
 
127
}
128
 
129
class scheduled_test_task extends \core\task\scheduled_task {
130
    public function get_name() {
131
        return "Test task";
132
    }
133
 
134
    public function execute() {
135
    }
136
}
137
 
138
class scheduled_test2_task extends \core\task\scheduled_task {
139
    public function get_name() {
140
        return "Test task 2";
141
    }
142
 
143
    public function execute() {
144
    }
145
}
146
 
147
class scheduled_test3_task extends \core\task\scheduled_task {
148
    public function get_name() {
149
        return "Test task 3";
150
    }
151
 
152
    public function execute() {
153
    }
154
}
155
 
156
namespace mod_fake\task;
157
 
158
class adhoc_component_task extends \core\task\adhoc_task {
159
    public function execute() {
160
 
161
    }
162
}