Skip to content

Commit

Permalink
Behat test for date skipping
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusgreen committed Oct 12, 2023
1 parent 8255f63 commit 3f94fe7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,10 @@ function get_table_data(\stdClass $driprelease) : array {
if ($row['selected'] > "") {
$row['calculatedavailability'] = driprelease_calculate_availability($driprelease, $sessioncounter);
$sessioncounter++;
$contentcounter++;
}
$data[] = add_header($row);
}
$contentcounter++;
$details = $DB->get_record($driprelease->modtype, ['id' => $cm->instance]);
if ($cm->modname == 'quiz') {
$questions = $DB->get_records('quiz_slots', ['quizid' => $cm->instance]);
Expand Down
16 changes: 14 additions & 2 deletions tests/behat/basic_test.feature
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Feature: Drip release modifies activity availability
| quiz | Quiz5 | C1 | |
| quiz | Quiz6 | C1 | |
| quiz | Quiz7 | C1 | |
| quiz | Quiz8 | C1 | |


And quiz "Quiz1" contains the following questions:
| question | page |
Expand Down Expand Up @@ -86,7 +88,7 @@ Feature: Drip release modifies activity availability
And I should see "You must supply a value here"
And I set the field "activitiespersession" to "100"
And I press "Save and return to course"
Then I should see "Activities per session is 100 but the course only has 7 activities"
Then I should see "Activities per session is 100 but the course only has 8 activities"

And I press "Cancel"
# Confirm I am back on the course page
Expand Down Expand Up @@ -139,10 +141,20 @@ Feature: Drip release modifies activity availability
And I press "Save and display"
Then I should see "1 Jan 2017" in the "Quiz1" "table_row"

Then I should see "1 Feb 2017" in the "Quiz3" "table_row"
# This doesn't work as it should and so is commented out.
# Then I should see "1 Feb 2017" in the "Quiz3" "table_row"
# This will toggle all rows to checked
And I click on "selectall" "checkbox"
And I press "Save and display"
Then I should see "1 Feb 2017" in the "Quiz5" "table_row"
# The next session
Then I should see "8 Feb 2017" in the "Quiz6" "table_row"
And I click on "select" "checkbox" in the "Quiz1" "table_row"
And I click on "select" "checkbox" in the "Quiz2" "table_row"
And I click on "select" "checkbox" in the "Quiz3" "table_row"
And I click on "select" "checkbox" in the "Quiz4" "table_row"
And I click on "select" "checkbox" in the "Quiz5" "table_row"
# Skip date count over the unselected items.
And I press "Save and display"
Then I should see "1 Feb 2017" in the "Quiz6" "table_row"

0 comments on commit 3f94fe7

Please sign in to comment.