Proyectos de Subversion Moodle

Rev

Rev 11 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 11 Rev 1441
Línea 153... Línea 153...
153
                // Increase the size to avoid this.
153
                // Increase the size to avoid this.
154
                $this->execute('behat_general::i_change_window_size_to', ['window', 'large']);
154
                $this->execute('behat_general::i_change_window_size_to', ['window', 'large']);
155
                return new moodle_url('/question/edit.php', [
155
                return new moodle_url('/question/edit.php', [
156
                    'cmid' => $this->get_cm_by_quiz_name($identifier)->id,
156
                    'cmid' => $this->get_cm_by_quiz_name($identifier)->id,
157
                ]);
157
                ]);
158
 
-
 
-
 
158
            case 'question categories':
-
 
159
                return new moodle_url('/question/bank/managecategories/category.php', [
-
 
160
                    'cmid' => $this->get_cm_by_quiz_name($identifier)->id,
-
 
161
                ]);
Línea 159... Línea 162...
159
 
162
 
160
            default:
163
            default:
161
                throw new Exception('Unrecognised quiz page type "' . $type . '."');
164
                throw new Exception('Unrecognised quiz page type "' . $type . '."');
162
        }
165
        }
Línea 483... Línea 486...
483
        if (!$this->running_javascript()) {
486
        if (!$this->running_javascript()) {
484
            throw new DriverException('Activities actions menu not available when Javascript is disabled');
487
            throw new DriverException('Activities actions menu not available when Javascript is disabled');
485
        }
488
        }
Línea 486... Línea 489...
486
 
489
 
487
        if ($pageorlast == 'last') {
490
        if ($pageorlast == 'last') {
488
            $xpath = "//div[@class = 'last-add-menu']//a[contains(@data-toggle, 'dropdown') and contains(., 'Add')]";
491
            $xpath = "//div[@class = 'last-add-menu']//a[contains(@data-bs-toggle, 'dropdown') and contains(., 'Add')]";
489
        } else if (preg_match('~Page (\d+)~', $pageorlast, $matches)) {
492
        } else if (preg_match('~Page (\d+)~', $pageorlast, $matches)) {
490
            $xpath = "//li[@id = 'page-{$matches[1]}']//a[contains(@data-toggle, 'dropdown') and contains(., 'Add')]";
493
            $xpath = "//li[@id = 'page-{$matches[1]}']//a[contains(@data-bs-toggle, 'dropdown') and contains(., 'Add')]";
491
        } else {
494
        } else {
492
            throw new ExpectationException("The I open the add to quiz menu step must specify either 'Page N' or 'last'.",
495
            throw new ExpectationException("The I open the add to quiz menu step must specify either 'Page N' or 'last'.",
493
                $this->getSession());
496
                $this->getSession());
494
        }
497
        }
Línea 1010... Línea 1013...
1010
 
1013
 
Línea 1011... Línea 1014...
1011
        $this->set_user($user);
1014
        $this->set_user($user);
1012
 
1015
 
1013
        $attempts = quiz_get_user_attempts($quizid, $user->id, 'unfinished', true);
1016
        $attempts = quiz_get_user_attempts($quizid, $user->id, 'unfinished', true);
-
 
1017
        $attemptobj = quiz_attempt::create(key($attempts));
Línea 1014... Línea 1018...
1014
        $attemptobj = quiz_attempt::create(key($attempts));
1018
        $attemptobj->process_submit(time(), true);
1015
        $attemptobj->process_finish(time(), true);
1019
        $attemptobj->process_grade_submission(time());
Línea 1016... Línea 1020...
1016
 
1020
 
Línea 1051... Línea 1055...
1051
        return [
1055
        return [
1052
            new behat_component_named_selector('Edit slot',
1056
            new behat_component_named_selector('Edit slot',
1053
            ["//li[contains(@class,'qtype')]//span[@class='slotnumber' and contains(., %locator%)]/.."])
1057
            ["//li[contains(@class,'qtype')]//span[@class='slotnumber' and contains(., %locator%)]/.."])
1054
        ];
1058
        ];
1055
    }
1059
    }
-
 
1060
 
-
 
1061
    /**
-
 
1062
     * Generate pre-created attempts for a quiz.
-
 
1063
     *
-
 
1064
     * @param string $quizname the name of the quiz to create attempts for.
-
 
1065
     * @Given quiz :quizname has pre-created attempts
-
 
1066
     */
-
 
1067
    public function quiz_has_precreated_attempts(string $quizname): void {
-
 
1068
        global $DB;
-
 
1069
 
-
 
1070
        $quiz = $DB->get_record('quiz', ['name' => $quizname], 'id, course', MUST_EXIST);
-
 
1071
        \mod_quiz\task\precreate_attempts::precreate_attempts_for_quiz($quiz->id, $quiz->course);
-
 
1072
    }
1056
}
1073
}