Skip to content

Commit

Permalink
Merge branch 'MDL-47797' of git://github.com/timhunt/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
danpoltawski committed Oct 31, 2014
2 parents b4eaafd + 234c533 commit 1de9b50
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 17 deletions.
2 changes: 2 additions & 0 deletions lang/en/question.php
Expand Up @@ -426,8 +426,10 @@
$string['technicalinfominfraction'] = 'Minimum fraction: {$a}';
$string['technicalinfomaxfraction'] = 'Maximum fraction: {$a}';
$string['technicalinfoquestionsummary'] = 'Question summary: {$a}';
$string['technicalinforesponsesummary'] = 'Response summary: {$a}';
$string['technicalinforightsummary'] = 'Right answer summary: {$a}';
$string['technicalinfostate'] = 'Question state: {$a}';
$string['technicalinfovariant'] = 'Question variant: {$a}';
$string['unknownbehaviour'] = 'Unknown behaviour: {$a}.';
$string['unknownorunhandledtype'] = 'Unknown or unhandled question type: {$a}';
$string['unknownquestion'] = 'Unknown question: {$a}.';
Expand Down
2 changes: 2 additions & 0 deletions question/preview.php
Expand Up @@ -227,8 +227,10 @@
question_engine::get_behaviour_name($qa->get_behaviour_name()));
$technical[] = get_string('technicalinfominfraction', 'question', $qa->get_min_fraction());
$technical[] = get_string('technicalinfomaxfraction', 'question', $qa->get_max_fraction());
$technical[] = get_string('technicalinfovariant', 'question', $qa->get_variant());
$technical[] = get_string('technicalinfoquestionsummary', 'question', s($qa->get_question_summary()));
$technical[] = get_string('technicalinforightsummary', 'question', s($qa->get_right_answer_summary()));
$technical[] = get_string('technicalinforesponsesummary', 'question', s($qa->get_response_summary()));
$technical[] = get_string('technicalinfostate', 'question', '' . $qa->get_state());

// Start output.
Expand Down
50 changes: 33 additions & 17 deletions question/tests/behat/preview_question.feature
Expand Up @@ -7,39 +7,55 @@ Feature: A teacher can preview questions in the question bank
@javascript
Scenario: Preview a previously created question
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | weeks |
| Course 1 | C1 | weeks |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I follow "Course 1"
And I add a "Numerical" question filling the form with:
| Question name | Test question to be previewed |
| Question text | How much is 1 + 1 |
| answer[0] | 2 |
| fraction[0] | 100% |
| answer[1] | * |
| fraction[1] | None |
| Question text | How much is 1 + 1 |
| answer[0] | 2 |
| fraction[0] | 100% |
| answer[1] | * |
| fraction[1] | None |

When I click on "Preview" "link" in the "Test question to be previewed" "table_row"
And I switch to "questionpreview" window
And I set the following fields to these values:
| Whether correct | Shown |
| Whether correct | Shown |
| How questions behave | Deferred feedback |
And I press "Start again with these options"
Then I should see "Not yet answered"
And I set the field "Answer:" to "2"
And I press "Submit and finish"
And the state of "How much is 1 + 1" question is shown as "Correct"
And I press "Start again"
And the state of "How much is 1 + 1" question is shown as "Not yet answered"

Then I should see "How much is 1 + 1"
And I should see "Technical information"
And I should see "Attempt options"
And I should see "Display options"

And I set the field "Answer:" to "1"
And I press "Save"
And the state of "How much is 1 + 1" question is shown as "Answer saved"

And I press "Submit and finish"
And the state of "How much is 1 + 1" question is shown as "Incorrect"

And I press "Start again"
And the state of "How much is 1 + 1" question is shown as "Not yet answered"

And I press "Fill in correct responses"
And the field "Answer:" matches value "2"
And the state of "How much is 1 + 1" question is shown as "Answer saved"

And I set the field "Whether correct" to "Not shown"
And I press "Update display options"
And the state of "How much is 1 + 1" question is shown as "Answer saved"

And I press "Submit and finish"
And the state of "How much is 1 + 1" question is shown as "Complete"

And I switch to the main window

0 comments on commit 1de9b50

Please sign in to comment.