1 |
efrain |
1 |
@tool @tool_recyclebin
|
|
|
2 |
Feature: Backup user data
|
|
|
3 |
As a teacher
|
|
|
4 |
I want user data to be backed up when I delete a course module
|
|
|
5 |
So that I can recover student content
|
|
|
6 |
|
|
|
7 |
Background: Course with teacher and student exist.
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher1 | Teacher | 1 | teacher@asd.com |
|
|
|
11 |
| student1 | Student | 1 | student@asd.com |
|
|
|
12 |
And the following "courses" exist:
|
|
|
13 |
| fullname | shortname |
|
|
|
14 |
| Course 1 | C1 |
|
|
|
15 |
And the following "course enrolments" exist:
|
|
|
16 |
| user | course | role |
|
|
|
17 |
| teacher1 | C1 | editingteacher |
|
|
|
18 |
| student1 | C1 | student |
|
|
|
19 |
And the following config values are set as admin:
|
|
|
20 |
| coursebinenable | 1 | tool_recyclebin |
|
|
|
21 |
| autohide | 0 | tool_recyclebin |
|
|
|
22 |
And the following "activities" exist:
|
|
|
23 |
| activity | course | section | name | intro |
|
|
|
24 |
| quiz | C1 | 1 | Quiz 1 | Test quiz description |
|
|
|
25 |
And the following "question categories" exist:
|
|
|
26 |
| contextlevel | reference | name |
|
|
|
27 |
| Course | C1 | Test questions |
|
|
|
28 |
And the following "questions" exist:
|
|
|
29 |
| questioncategory | qtype | name | questiontext |
|
|
|
30 |
| Test questions | truefalse | TF1 | First question |
|
|
|
31 |
| Test questions | truefalse | TF2 | Second question |
|
|
|
32 |
And quiz "Quiz 1" contains the following questions:
|
|
|
33 |
| question | page |
|
|
|
34 |
| TF1 | 1 |
|
|
|
35 |
| TF2 | 1 |
|
|
|
36 |
|
|
|
37 |
@javascript
|
|
|
38 |
Scenario Outline: Delete and restore a quiz with user data
|
|
|
39 |
Given the following config values are set as admin:
|
|
|
40 |
| restore_general_users | <include_user> | restore |
|
|
|
41 |
And I am on the "Quiz 1" "quiz activity" page logged in as student1
|
|
|
42 |
And I press "Attempt quiz"
|
|
|
43 |
And I click on "True" "radio" in the "First question" "question"
|
|
|
44 |
And I click on "False" "radio" in the "Second question" "question"
|
|
|
45 |
And I press "Finish attempt"
|
|
|
46 |
And I press "Submit all and finish"
|
|
|
47 |
And I click on "Submit" "button" in the "Submit all your answers and finish?" "dialogue"
|
|
|
48 |
And I should see "50.00 out of 100.00"
|
|
|
49 |
And I log out
|
|
|
50 |
And I log in as "teacher1"
|
|
|
51 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
52 |
And I delete "Quiz 1" activity
|
|
|
53 |
And I run all adhoc tasks
|
|
|
54 |
And I navigate to "Recycle bin" in current page administration
|
|
|
55 |
And I should see "Quiz 1"
|
|
|
56 |
And I click on "Restore" "link" in the "region-main" "region"
|
|
|
57 |
When I am on the "Course 1" "grades > User report > View" page logged in as "student1"
|
|
|
58 |
Then "Quiz 1" row "Grade" column of "user-grade" table should contain "50"
|
|
|
59 |
And "Quiz 1" row "Percentage" column of "user-grade" table should contain "50"
|
|
|
60 |
|
|
|
61 |
Examples:
|
|
|
62 |
| include_user | case_explanation |
|
|
|
63 |
| 1 | Checked |
|
|
|
64 |
| 1 | Unchecked |
|