Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 32... Línea 32...
32
 * @package    qbehaviour_manualgraded
32
 * @package    qbehaviour_manualgraded
33
 * @copyright  2009 The Open University
33
 * @copyright  2009 The Open University
34
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
34
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
35
 */
35
 */
36
class walkthrough_test extends \qbehaviour_walkthrough_test_base {
36
class walkthrough_test extends \qbehaviour_walkthrough_test_base {
37
    public function test_manual_graded_essay() {
37
    public function test_manual_graded_essay(): void {
38
        global $PAGE;
38
        global $PAGE;
Línea 39... Línea 39...
39
 
39
 
40
        // The current text editor depends on the users profile setting - so it needs a valid user.
40
        // The current text editor depends on the users profile setting - so it needs a valid user.
41
        $this->setAdminUser();
41
        $this->setAdminUser();
Línea 105... Línea 105...
105
        // Verify.
105
        // Verify.
106
        $this->check_current_state(question_state::$mangrright);
106
        $this->check_current_state(question_state::$mangrright);
107
        $this->check_current_mark(1);
107
        $this->check_current_mark(1);
108
    }
108
    }
Línea 109... Línea 109...
109
 
109
 
110
    public function test_manual_graded_essay_not_answered() {
110
    public function test_manual_graded_essay_not_answered(): void {
Línea 111... Línea 111...
111
        global $PAGE;
111
        global $PAGE;
112
 
112
 
113
        // The current text editor depends on the users profile setting - so it needs a valid user.
113
        // The current text editor depends on the users profile setting - so it needs a valid user.
Línea 153... Línea 153...
153
        // Verify.
153
        // Verify.
154
        $this->check_current_state(question_state::$mangrpartial);
154
        $this->check_current_state(question_state::$mangrpartial);
155
        $this->check_current_mark(0.1);
155
        $this->check_current_mark(0.1);
156
    }
156
    }
Línea 157... Línea 157...
157
 
157
 
Línea 158... Línea 158...
158
    public function test_manual_graded_truefalse() {
158
    public function test_manual_graded_truefalse(): void {
159
 
159
 
160
        // Create a true-false question with correct answer true.
160
        // Create a true-false question with correct answer true.
Línea 197... Línea 197...
197
            $this->get_does_not_contain_correctness_expectation(),
197
            $this->get_does_not_contain_correctness_expectation(),
198
            $this->get_does_not_contain_specific_feedback_expectation(),
198
            $this->get_does_not_contain_specific_feedback_expectation(),
199
            new \question_pattern_expectation('/' . preg_quote('Not good enough!', '/') . '/'));
199
            new \question_pattern_expectation('/' . preg_quote('Not good enough!', '/') . '/'));
200
    }
200
    }
Línea 201... Línea 201...
201
 
201
 
202
    public function test_manual_grade_ungraded_question() {
202
    public function test_manual_grade_ungraded_question(): void {
Línea 203... Línea 203...
203
        global $PAGE;
203
        global $PAGE;
204
 
204
 
205
        // The current text editor depends on the users profile setting - so it needs a valid user.
205
        // The current text editor depends on the users profile setting - so it needs a valid user.
Línea 254... Línea 254...
254
        $this->check_current_mark(null);
254
        $this->check_current_mark(null);
255
        $this->check_current_output(
255
        $this->check_current_output(
256
                new \question_pattern_expectation('/' . preg_quote('Not good enough!', '/') . '/'));
256
                new \question_pattern_expectation('/' . preg_quote('Not good enough!', '/') . '/'));
257
    }
257
    }
Línea 258... Línea 258...
258
 
258
 
259
    public function test_manual_graded_ignore_repeat_sumbission() {
259
    public function test_manual_graded_ignore_repeat_sumbission(): void {
260
        // Create an essay question.
260
        // Create an essay question.
261
        $essay = \test_question_maker::make_an_essay_question();
261
        $essay = \test_question_maker::make_an_essay_question();
Línea 262... Línea 262...
262
        $this->start_attempt_at_question($essay, 'deferredfeedback', 10);
262
        $this->start_attempt_at_question($essay, 'deferredfeedback', 10);
Línea 328... Línea 328...
328
        $qa = $this->quba->get_question_attempt($this->slot);
328
        $qa = $this->quba->get_question_attempt($this->slot);
329
        $this->assertEquals('Commented: Actually, I am not sure any more.',
329
        $this->assertEquals('Commented: Actually, I am not sure any more.',
330
                $qa->summarise_action($qa->get_last_step()));
330
                $qa->summarise_action($qa->get_last_step()));
331
    }
331
    }
Línea 332... Línea 332...
332
 
332
 
333
    public function test_manual_graded_ignore_repeat_sumbission_commas() {
333
    public function test_manual_graded_ignore_repeat_sumbission_commas(): void {
334
        // Create an essay question.
334
        // Create an essay question.
335
        $essay = \test_question_maker::make_an_essay_question();
335
        $essay = \test_question_maker::make_an_essay_question();
Línea 336... Línea 336...
336
        $this->start_attempt_at_question($essay, 'deferredfeedback', 10);
336
        $this->start_attempt_at_question($essay, 'deferredfeedback', 10);
Línea 376... Línea 376...
376
        $this->check_step_count($numsteps + 1);
376
        $this->check_step_count($numsteps + 1);
377
        $this->check_current_state(question_state::$mangrpartial);
377
        $this->check_current_state(question_state::$mangrpartial);
378
        $this->check_current_mark(9);
378
        $this->check_current_mark(9);
379
    }
379
    }
Línea 380... Línea 380...
380
 
380
 
381
    public function test_manual_graded_essay_can_grade_0() {
381
    public function test_manual_graded_essay_can_grade_0(): void {
Línea 382... Línea 382...
382
        global $PAGE;
382
        global $PAGE;
383
 
383
 
384
        // The current text editor depends on the users profile setting - so it needs a valid user.
384
        // The current text editor depends on the users profile setting - so it needs a valid user.
Línea 426... Línea 426...
426
        // Verify.
426
        // Verify.
427
        $this->check_current_state(question_state::$mangrwrong);
427
        $this->check_current_state(question_state::$mangrwrong);
428
        $this->check_current_mark(0);
428
        $this->check_current_mark(0);
429
    }
429
    }
Línea 430... Línea 430...
430
 
430
 
431
    public function test_manual_graded_change_comment_format() {
431
    public function test_manual_graded_change_comment_format(): void {
Línea 432... Línea 432...
432
        global $PAGE;
432
        global $PAGE;
433
 
433
 
434
        // The current text editor depends on the users profile setting - so it needs a valid user.
434
        // The current text editor depends on the users profile setting - so it needs a valid user.
Línea 455... Línea 455...
455
        $this->manual_grade('example', 0, FORMAT_MARKDOWN);
455
        $this->manual_grade('example', 0, FORMAT_MARKDOWN);
456
        // Verify the format is FORMAT_MARKDOWN.
456
        // Verify the format is FORMAT_MARKDOWN.
457
        $this->check_comment('example', FORMAT_MARKDOWN);
457
        $this->check_comment('example', FORMAT_MARKDOWN);
458
    }
458
    }
Línea 459... Línea 459...
459
 
459
 
460
    public function test_manual_graded_respects_display_options() {
460
    public function test_manual_graded_respects_display_options(): void {
461
        // This test is for MDL-43874. Manual comments were not respecting the
461
        // This test is for MDL-43874. Manual comments were not respecting the
462
        // Display options for feedback.
462
        // Display options for feedback.
Línea 463... Línea 463...
463
        global $PAGE;
463
        global $PAGE;
Línea 512... Línea 512...
512
        $this->check_output_does_not_contain('This should only appear if the displya options allow it');
512
        $this->check_output_does_not_contain('This should only appear if the displya options allow it');
513
        $this->displayoptions->manualcomment = question_display_options::VISIBLE;
513
        $this->displayoptions->manualcomment = question_display_options::VISIBLE;
514
        $this->check_output_contains('This should only appear if the displya options allow it');
514
        $this->check_output_contains('This should only appear if the displya options allow it');
515
    }
515
    }
Línea 516... Línea 516...
516
 
516
 
517
    public function test_manual_graded_invalid_value_throws_exception() {
517
    public function test_manual_graded_invalid_value_throws_exception(): void {
Línea 518... Línea 518...
518
        global $PAGE;
518
        global $PAGE;
519
 
519
 
520
        // The current text editor depends on the users profile setting - so it needs a valid user.
520
        // The current text editor depends on the users profile setting - so it needs a valid user.
Línea 559... Línea 559...
559
        // Try to process a an invalid grade.
559
        // Try to process a an invalid grade.
560
        $this->expectException('coding_exception');
560
        $this->expectException('coding_exception');
561
        $this->manual_grade('Comment', 'frog', FORMAT_HTML);
561
        $this->manual_grade('Comment', 'frog', FORMAT_HTML);
562
    }
562
    }
Línea 563... Línea 563...
563
 
563
 
564
    public function test_manual_graded_out_of_range_throws_exception() {
564
    public function test_manual_graded_out_of_range_throws_exception(): void {
Línea 565... Línea 565...
565
        global $PAGE;
565
        global $PAGE;
566
 
566
 
567
        // The current text editor depends on the users profile setting - so it needs a valid user.
567
        // The current text editor depends on the users profile setting - so it needs a valid user.
Línea 606... Línea 606...
606
        // Try to process a an invalid grade.
606
        // Try to process a an invalid grade.
607
        $this->expectException('coding_exception');
607
        $this->expectException('coding_exception');
608
        $this->manual_grade('Comment', '10.1', FORMAT_HTML);
608
        $this->manual_grade('Comment', '10.1', FORMAT_HTML);
609
    }
609
    }
Línea 610... Línea 610...
610
 
610
 
Línea 611... Línea 611...
611
    public function test_manual_graded_displays_proper_comment_format() {
611
    public function test_manual_graded_displays_proper_comment_format(): void {
Línea 612... Línea 612...
612
 
612
 
613
        global $PAGE;
613
        global $PAGE;
Línea 645... Línea 645...
645
        $this->check_current_output(
645
        $this->check_current_output(
646
            new \question_pattern_expectation($preg)
646
            new \question_pattern_expectation($preg)
647
        );
647
        );
648
    }
648
    }
Línea 649... Línea 649...
649
 
649
 
650
    public function test_manual_grading_reshows_exactly_the_mark_input() {
650
    public function test_manual_grading_reshows_exactly_the_mark_input(): void {
Línea 651... Línea 651...
651
        global $PAGE;
651
        global $PAGE;
652
 
652
 
653
        // The current text editor depends on the users profile setting - so it needs a valid user.
653
        // The current text editor depends on the users profile setting - so it needs a valid user.
Línea 681... Línea 681...
681
        $this->get_question_attempt()->set_max_mark(1);
681
        $this->get_question_attempt()->set_max_mark(1);
682
        $this->render();
682
        $this->render();
683
        $this->check_output_contains_text_input('-mark', '0.3333333');
683
        $this->check_output_contains_text_input('-mark', '0.3333333');
684
    }
684
    }
Línea 685... Línea 685...
685
 
685
 
686
    public function test_manual_grading_history_display() {
686
    public function test_manual_grading_history_display(): void {
Línea 687... Línea 687...
687
        global $PAGE;
687
        global $PAGE;
688
 
688
 
689
        // The current text editor depends on the users profile setting - so it needs a valid user.
689
        // The current text editor depends on the users profile setting - so it needs a valid user.