Skip to content

Commit

Permalink
added a behat test to test the matrix of possible settings for catego…
Browse files Browse the repository at this point in the history
…ries to be displayed
  • Loading branch information
NinaHerrmann committed Jun 11, 2024
1 parent eae2d5d commit 81e461b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
1 change: 0 additions & 1 deletion settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
get_string('config_enablecategoryhierachy', 'tool_lifecycle'),
get_string('config_enablecategoryhierachy_desc', 'tool_lifecycle'),
false);
// $settingenablehierachy->set_updatedcallback('tool_lifecycle_');
$settings->add($settingenablehierachy);
$coursehierachysetting = new admin_setting_configtext('tool_lifecycle/coursecategorydepth',
get_string('config_coursecategorydepth', 'tool_lifecycle'),
Expand Down
29 changes: 24 additions & 5 deletions tests/behat/interaction.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@ Feature: Add a workflow with an email step and test the interaction as a teacher
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "categories" exist:
| name | category | idnumber |
| Cat1 | 0 | 1 |
| Cat2 | 0 | 2 |
| Cat02 | 2 | 02 |
| Cat01 | 1 | 01 |
| Cat001 | 01 | 001 |
| Cat002 | 01 | 002 |
And the following "courses" exist:
| fullname | shortname | category | startdate |
| Course 1 | C1 | 0 | ##2 days ago## |
| Course 2 | C2 | 0 | ##4 days ago## |
| Course 3 | C3 | 0 | ##4 days ago## |
| Course 1 | C1 | 0 | ##2 days ago## |
| Course 2 | C2 | 001 | ##4 days ago## |
| Course 3 | C3 | 02 | ##4 days ago## |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
Expand Down Expand Up @@ -44,8 +52,12 @@ Feature: Add a workflow with an email step and test the interaction as a teacher
And I press "Activate"
And I log out

Scenario: Test interaction of email step
Given I log in as "teacher1"
Scenario Outline: Test interaction of email step
Given the following config values are set as admin:
| config | value | plugin |
| enablecategoryhierachy | <config> | tool_lifecycle |
| coursecategorydepth | <config1> | tool_lifecycle |
And I log in as "teacher1"
When I am on lifecycle view
Then I should see "Course 1" in the "tool_lifecycle_remaining" "table"
And I should see "Course 2" in the "tool_lifecycle_remaining" "table"
Expand All @@ -57,6 +69,8 @@ Feature: Add a workflow with an email step and test the interaction as a teacher
And I should see "Course 3" in the "tool_lifecycle_interaction" "table"
And I should see the tool "Keep course" in the "Course 2" row of the "tool_lifecycle_interaction" table
And I should see the tool "Keep course" in the "Course 3" row of the "tool_lifecycle_interaction" table
And I should see "<category1>" in the "tool_lifecycle_interaction" "table"
And I should see "<category2>" in the "tool_lifecycle_interaction" "table"
When I click on the tool "Keep course" in the "Course 2" row of the "tool_lifecycle_interaction" table
Then I should see "Course 1" in the "tool_lifecycle_remaining" "table"
And I should see "Course 2" in the "tool_lifecycle_remaining" "table"
Expand All @@ -67,3 +81,8 @@ Feature: Add a workflow with an email step and test the interaction as a teacher
Then I should see "Course 1" in the "tool_lifecycle_remaining" "table"
And I should see "Course 2" in the "tool_lifecycle_remaining" "table"
And I should not see "Course 3"
Examples:
| config | config1 | category1 | category2 |
| 0 | 0 | Cat001 | Cat02 |
| 1 | 0 | Cat1 | Cat2 |
| 1 | 2 | Cat001 | Cat02 |

0 comments on commit 81e461b

Please sign in to comment.