| Línea 28... |
Línea 28... |
| 28 |
*
|
28 |
*
|
| 29 |
* @package core_completion
|
29 |
* @package core_completion
|
| 30 |
* @copyright 2017 Marina Glancy
|
30 |
* @copyright 2017 Marina Glancy
|
| 31 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
31 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
| 32 |
*/
|
32 |
*/
|
| 33 |
class bulk_update_test extends \advanced_testcase {
|
33 |
final class bulk_update_test extends \advanced_testcase {
|
| Línea 34... |
Línea 34... |
| 34 |
|
34 |
|
| 35 |
/**
|
35 |
/**
|
| 36 |
* Provider for test_bulk_form_submit_single
|
36 |
* Provider for test_bulk_form_submit_single
|
| 37 |
* @return array
|
37 |
* @return array
|
| 38 |
*/
|
38 |
*/
|
| 39 |
public function bulk_form_submit_single_provider() {
|
39 |
public static function bulk_form_submit_single_provider(): array {
|
| 40 |
return [
|
40 |
return [
|
| 41 |
'assign-1' => ['assign', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionsubmit' => 1]],
|
41 |
'assign-1' => ['assign', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionsubmit' => 1]],
|
| 42 |
'assign-2' => ['assign', ['completion' => COMPLETION_TRACKING_MANUAL]],
|
42 |
'assign-2' => ['assign', ['completion' => COMPLETION_TRACKING_MANUAL]],
|
| 43 |
'book-1' => ['book', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionview' => 1]],
|
43 |
'book-1' => ['book', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionview' => 1]],
|
| 44 |
'book-2' => ['book', ['completion' => COMPLETION_TRACKING_MANUAL]],
|
- |
|
| 45 |
'chat-1' => ['chat', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionview' => 1]],
|
- |
|
| 46 |
'chat-2' => ['chat', ['completion' => COMPLETION_TRACKING_MANUAL]],
|
44 |
'book-2' => ['book', ['completion' => COMPLETION_TRACKING_MANUAL]],
|
| 47 |
'choice-1' => ['choice', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionsubmit' => 1]],
|
45 |
'choice-1' => ['choice', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionsubmit' => 1]],
|
| 48 |
'choice-2' => ['choice', ['completion' => COMPLETION_TRACKING_MANUAL]],
|
46 |
'choice-2' => ['choice', ['completion' => COMPLETION_TRACKING_MANUAL]],
|
| 49 |
'data-1' => ['data', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionview' => 1]],
|
47 |
'data-1' => ['data', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionview' => 1]],
|
| 50 |
'data-2' => ['data', ['completion' => COMPLETION_TRACKING_MANUAL]],
|
48 |
'data-2' => ['data', ['completion' => COMPLETION_TRACKING_MANUAL]],
|
| Línea 92... |
Línea 90... |
| 92 |
'completionscorerequired' => 1,
|
90 |
'completionscorerequired' => 1,
|
| 93 |
'completionstatusrequired' => 2,
|
91 |
'completionstatusrequired' => 2,
|
| 94 |
],
|
92 |
],
|
| 95 |
],
|
93 |
],
|
| 96 |
'scorm-2' => ['scorm', ['completion' => COMPLETION_TRACKING_MANUAL]],
|
94 |
'scorm-2' => ['scorm', ['completion' => COMPLETION_TRACKING_MANUAL]],
|
| 97 |
'survey-1' => ['survey', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionsubmit' => 1]],
|
- |
|
| 98 |
'survey-2' => ['survey', ['completion' => COMPLETION_TRACKING_MANUAL]],
|
- |
|
| 99 |
'url-1' => ['url', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionview' => 1]],
|
95 |
'url-1' => ['url', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionview' => 1]],
|
| 100 |
'url-2' => ['url', ['completion' => COMPLETION_TRACKING_MANUAL]],
|
96 |
'url-2' => ['url', ['completion' => COMPLETION_TRACKING_MANUAL]],
|
| 101 |
'wiki-1' => ['wiki', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionview' => 1]],
|
97 |
'wiki-1' => ['wiki', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionview' => 1]],
|
| 102 |
'wiki-2' => ['wiki', ['completion' => COMPLETION_TRACKING_MANUAL]],
|
98 |
'wiki-2' => ['wiki', ['completion' => COMPLETION_TRACKING_MANUAL]],
|
| 103 |
'workshop-1' => ['workshop', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionview' => 1]],
|
99 |
'workshop-1' => ['workshop', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionview' => 1]],
|
| Línea 156... |
Línea 152... |
| 156 |
* @return array array of two elements - course and list of cm_info objects
|
152 |
* @return array array of two elements - course and list of cm_info objects
|
| 157 |
*/
|
153 |
*/
|
| 158 |
protected function create_course_and_modules($modulenames) {
|
154 |
protected function create_course_and_modules($modulenames) {
|
| 159 |
global $CFG, $PAGE;
|
155 |
global $CFG, $PAGE;
|
| Línea 160... |
Línea -... |
| 160 |
|
- |
|
| 161 |
// Chat and Survey modules are disabled by default, enable them for testing.
|
- |
|
| 162 |
$manager = \core_plugin_manager::resolve_plugininfo_class('mod');
|
- |
|
| 163 |
$manager::enable_plugin('chat', 1);
|
- |
|
| 164 |
$manager::enable_plugin('survey', 1);
|
- |
|
| 165 |
|
156 |
|
| 166 |
$CFG->enablecompletion = true;
|
157 |
$CFG->enablecompletion = true;
|
| 167 |
$course = $this->getDataGenerator()->create_course(['enablecompletion' => 1], ['createsections' => true]);
|
158 |
$course = $this->getDataGenerator()->create_course(['enablecompletion' => 1], ['createsections' => true]);
|
| Línea 168... |
Línea 159... |
| 168 |
$PAGE->set_course($course);
|
159 |
$PAGE->set_course($course);
|
| Línea 182... |
Línea 173... |
| 182 |
|
173 |
|
| 183 |
/**
|
174 |
/**
|
| 184 |
* Provider for test_bulk_form_submit_multiple
|
175 |
* Provider for test_bulk_form_submit_multiple
|
| 185 |
* @return array
|
176 |
* @return array
|
| 186 |
*/
|
177 |
*/
|
| 187 |
public function bulk_form_submit_multiple_provider() {
|
178 |
public static function bulk_form_submit_multiple_provider(): array {
|
| 188 |
return [
|
179 |
return [
|
| 189 |
'Several modules with the same module type (choice)' => [
|
180 |
'Several modules with the same module type (choice)' => [
|
| 190 |
[
|
181 |
[
|
| 191 |
'modulenames' => ['choice', 'choice', 'choice'],
|
182 |
'modulenames' => ['choice', 'choice', 'choice'],
|
| Línea 213... |
Línea 204... |
| 213 |
'instancedata' => null
|
204 |
'instancedata' => null
|
| 214 |
]
|
205 |
]
|
| 215 |
],
|
206 |
],
|
| 216 |
'If at least one module does not support completionsubmit it can\'t be set' => [
|
207 |
'If at least one module does not support completionsubmit it can\'t be set' => [
|
| 217 |
[
|
208 |
[
|
| 218 |
'modulenames' => ['survey', 'wiki'],
|
209 |
'modulenames' => ['assign', 'wiki'],
|
| 219 |
'submitdata' => ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionview' => 1, 'completionsubmit' => 1],
|
210 |
'submitdata' => ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionview' => 1, 'completionsubmit' => 1],
|
| 220 |
'validatedata' => [],
|
211 |
'validatedata' => [],
|
| 221 |
'cmdata' => ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionview' => 1],
|
212 |
'cmdata' => ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionview' => 1],
|
| 222 |
'instancedata' => [['completionsubmit' => 0], []]
|
213 |
'instancedata' => [['completionsubmit' => 0], []]
|
| 223 |
]
|
214 |
]
|