|
18 | 18 | * This file contains tests that walks a question through the interactive |
19 | 19 | * behaviour. |
20 | 20 | * |
21 | | - * @package qbehaviour |
22 | | - * @subpackage interactive |
| 21 | + * @package qbehaviour_interactive |
23 | 22 | * @copyright 2009 The Open University |
24 | 23 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
25 | 24 | */ |
@@ -483,4 +482,52 @@ public function test_interactive_regrade_changing_num_tries_finished() { |
483 | 482 | // and I am currently interested in testing regrading here. |
484 | 483 | $this->check_current_mark(1); |
485 | 484 | } |
| 485 | + |
| 486 | + public function test_review_of_interactive_questions_before_finished() { |
| 487 | + // Create a multichoice multiple question. |
| 488 | + $q = test_question_maker::make_question('shortanswer'); |
| 489 | + $q->hints = array( |
| 490 | + new question_hint_with_parts(0, 'This is the first hint.', FORMAT_HTML, true, true), |
| 491 | + new question_hint_with_parts(0, 'This is the second hint.', FORMAT_HTML, true, true), |
| 492 | + ); |
| 493 | + $this->start_attempt_at_question($q, 'interactive', 3); |
| 494 | + |
| 495 | + // Check the initial state. |
| 496 | + $this->check_current_state(question_state::$todo); |
| 497 | + $this->check_current_mark(null); |
| 498 | + $this->check_current_output( |
| 499 | + $this->get_contains_submit_button_expectation(true), |
| 500 | + $this->get_does_not_contain_feedback_expectation(), |
| 501 | + $this->get_tries_remaining_expectation(3), |
| 502 | + $this->get_does_not_contain_try_again_button_expectation()); |
| 503 | + |
| 504 | + // Now check what the teacher sees when they review the question. |
| 505 | + $this->displayoptions->readonly = true; |
| 506 | + $this->check_current_output( |
| 507 | + $this->get_contains_submit_button_expectation(false), |
| 508 | + $this->get_does_not_contain_feedback_expectation(), |
| 509 | + $this->get_tries_remaining_expectation(3), |
| 510 | + $this->get_does_not_contain_try_again_button_expectation()); |
| 511 | + $this->displayoptions->readonly = false; |
| 512 | + |
| 513 | + // Submit a wrong answer. |
| 514 | + $this->process_submission(array('answer' => 'cat', '-submit' => 1)); |
| 515 | + |
| 516 | + // Check the Try again button now shows up correctly. |
| 517 | + $this->check_current_state(question_state::$todo); |
| 518 | + $this->check_current_mark(null); |
| 519 | + $this->check_current_output( |
| 520 | + $this->get_does_not_contain_submit_button_expectation(), |
| 521 | + $this->get_contains_hint_expectation('This is the first hint.'), |
| 522 | + $this->get_tries_remaining_expectation(2), |
| 523 | + $this->get_contains_try_again_button_expectation(true)); |
| 524 | + |
| 525 | + // And check that a disabled Try again button shows up when the question is reviewed. |
| 526 | + $this->displayoptions->readonly = true; |
| 527 | + $this->check_current_output( |
| 528 | + $this->get_does_not_contain_submit_button_expectation(), |
| 529 | + $this->get_contains_hint_expectation('This is the first hint.'), |
| 530 | + $this->get_tries_remaining_expectation(2), |
| 531 | + $this->get_contains_try_again_button_expectation(false)); |
| 532 | + } |
486 | 533 | } |
0 commit comments