Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 137... Línea 137...
137
 
137
 
138
    /**
138
    /**
139
     * Test checking the completion state of a quiz base on core's completionpassgrade criteria.
139
     * Test checking the completion state of a quiz base on core's completionpassgrade criteria.
140
     * The quiz requires a passing grade to be completed.
140
     * The quiz requires a passing grade to be completed.
141
     */
141
     */
142
    public function test_completionpass() {
142
    public function test_completionpass(): void {
143
        list($students, $quiz, $cm) = $this->setup_quiz_for_testing_completion([
143
        list($students, $quiz, $cm) = $this->setup_quiz_for_testing_completion([
144
            'nbstudents' => 2,
144
            'nbstudents' => 2,
145
            'qtype' => 'numerical',
145
            'qtype' => 'numerical',
146
            'quizoptions' => [
146
            'quizoptions' => [
Línea 192... Línea 192...
192
     * To be completed, this quiz requires either a passing grade or for all attempts to be used up.
192
     * To be completed, this quiz requires either a passing grade or for all attempts to be used up.
193
     *
193
     *
194
     * @covers ::get_state
194
     * @covers ::get_state
195
     * @covers ::get_custom_rule_descriptions
195
     * @covers ::get_custom_rule_descriptions
196
     */
196
     */
197
    public function test_completionexhausted() {
197
    public function test_completionexhausted(): void {
198
        list($students, $quiz, $cm) = $this->setup_quiz_for_testing_completion([
198
        list($students, $quiz, $cm) = $this->setup_quiz_for_testing_completion([
199
            'nbstudents' => 2,
199
            'nbstudents' => 2,
200
            'qtype' => 'numerical',
200
            'qtype' => 'numerical',
201
            'quizoptions' => [
201
            'quizoptions' => [
202
                'attempts' => 2,
202
                'attempts' => 2,
Línea 270... Línea 270...
270
     * To be completed, this quiz requires a minimum number of attempts.
270
     * To be completed, this quiz requires a minimum number of attempts.
271
     *
271
     *
272
     * @covers ::get_state
272
     * @covers ::get_state
273
     * @covers ::get_custom_rule_descriptions
273
     * @covers ::get_custom_rule_descriptions
274
     */
274
     */
275
    public function test_completionminattempts() {
275
    public function test_completionminattempts(): void {
276
        list($students, $quiz, $cm) = $this->setup_quiz_for_testing_completion([
276
        list($students, $quiz, $cm) = $this->setup_quiz_for_testing_completion([
277
            'nbstudents' => 1,
277
            'nbstudents' => 1,
278
            'qtype' => 'essay',
278
            'qtype' => 'essay',
279
            'quizoptions' => [
279
            'quizoptions' => [
280
                'completionminattemptsenabled' => 1,
280
                'completionminattemptsenabled' => 1,
Línea 322... Línea 322...
322
    /**
322
    /**
323
     * Test for get_defined_custom_rules().
323
     * Test for get_defined_custom_rules().
324
     *
324
     *
325
     * @covers ::get_defined_custom_rules
325
     * @covers ::get_defined_custom_rules
326
     */
326
     */
327
    public function test_get_defined_custom_rules() {
327
    public function test_get_defined_custom_rules(): void {
328
        $rules = custom_completion::get_defined_custom_rules();
328
        $rules = custom_completion::get_defined_custom_rules();
329
        $this->assertCount(2, $rules);
329
        $this->assertCount(2, $rules);
330
        $this->assertEquals(
330
        $this->assertEquals(
331
            ['completionpassorattemptsexhausted', 'completionminattempts'],
331
            ['completionpassorattemptsexhausted', 'completionminattempts'],
332
            $rules
332
            $rules
Línea 336... Línea 336...
336
    /**
336
    /**
337
     * Test update moduleinfo.
337
     * Test update moduleinfo.
338
     *
338
     *
339
     * @covers \update_moduleinfo
339
     * @covers \update_moduleinfo
340
     */
340
     */
341
    public function test_update_moduleinfo() {
341
    public function test_update_moduleinfo(): void {
342
        $this->setAdminUser();
342
        $this->setAdminUser();
343
        // We need lite cm object not a full cm because update_moduleinfo is not allow some properties to be updated.
343
        // We need lite cm object not a full cm because update_moduleinfo is not allow some properties to be updated.
344
        list($students, $quiz, $cm, $litecm) = $this->setup_quiz_for_testing_completion([
344
        list($students, $quiz, $cm, $litecm) = $this->setup_quiz_for_testing_completion([
345
            'nbstudents' => 1,
345
            'nbstudents' => 1,
346
            'qtype' => 'numerical',
346
            'qtype' => 'numerical',