Skip to content

Commit

Permalink
Merge branch 'MDL-45362-master' of https://github.com/sammarshallou/m…
Browse files Browse the repository at this point in the history
  • Loading branch information
danpoltawski committed May 2, 2014
2 parents eb72c1f + a3a2423 commit 39f3329
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
5 changes: 2 additions & 3 deletions availability/condition/date/classes/condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,9 @@ protected function show_time($time, $dateonly, $until = false) {
* timezone).
*
* @param int $time Time
* @return bool True if time refers to midnight, false if it's some other
* time or if it is set to zero
* @return bool True if time refers to midnight, false otherwise
*/
protected static function is_midnight($time) {
return $time && usergetmidnight($time) == $time;
return usergetmidnight($time) == $time;
}
}
22 changes: 20 additions & 2 deletions availability/tests/behat/display_availability.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@ Feature: display_availability
As a user
I need to see appropriate availability restrictions for activities and sections

# PURPOSE OF THIS TEST FEATURE:
#
# This test is to do a basic check of the user interface relating to display
# of availability conditions - i.e. if there's a condition, does it show up;
# are we doing the HTML correctly; does it correctly hide an activity where
# the options are set to not show it at all.
#
# Things this test is not:
# - It is not a test of the date condition specifically. The date condition is
# only used as an example in order to get the availability information to
# display. (The date condition has its own Behat test in
# /availability/condition/date/tests/behat.)
# - It is not a complete test of the logic. This is supposed to be a shallow
# check of the user interface parts and doesn't cover all logical
# possibilities. The logic is tested in PHPUnit tests instead, which are
# much more efficient. (Again there are unit tests for the overall system
# and for each condition type.)

Background:
Given the following "courses" exist:
| fullname | shortname | format |
Expand Down Expand Up @@ -39,7 +57,7 @@ Feature: display_availability
And I click on "Date" "button" in the "Add restriction..." "dialogue"
And I set the field "direction" to "until"
And I set the field "x[year]" to "2013"
And I set the field "x[month]" to "January"
And I set the field "x[month]" to "March"
And I press "Save and return to course"

# Add a Page with 2 restrictions - one is set to hide from students if failed.
Expand All @@ -53,7 +71,7 @@ Feature: display_availability
And I click on "Date" "button" in the "Add restriction..." "dialogue"
And I set the field "direction" to "until"
And I set the field "x[year]" to "2013"
And I set the field "x[month]" to "January"
And I set the field "x[month]" to "March"
And I click on ".availability-item .availability-eye img" "css_element"
And I press "Add restriction..."
And I click on "User profile" "button" in the "Add restriction..." "dialogue"
Expand Down
11 changes: 11 additions & 0 deletions availability/tests/behat/edit_availability.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ Feature: edit_availability
As a teacher
I need to set up availability options for activities and sections

# PURPOSE OF THIS TEST FEATURE:
#
# This test covers the user interface around editing availability conditions,
# especially the JavaScript code which is not tested elsewhere (e.g. does the
# 'Add restriction' dialog work). It tests both forms and also the admin
# setting interface.
#
# This test does not check the detailed behaviour of the availability system,
# which is mainly covered in PHPUnit (and, from the user interface
# perspective, in the other Behat tests for each type of condition).

Background:
Given the following "courses" exist:
| fullname | shortname | format |
Expand Down

0 comments on commit 39f3329

Please sign in to comment.