Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'MDL-62813-master' of git://github.com/lameze/moodle
  • Loading branch information
David Monllao committed Jul 3, 2018
2 parents de0b684 + 23b05f1 commit f883974
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
3 changes: 1 addition & 2 deletions calendar/classes/local/event/forms/create.php
Expand Up @@ -119,10 +119,9 @@ public function validation($data, $files) {
global $DB, $CFG;

$errors = parent::validation($data, $files);
$coursekey = isset($data['groupcourseid']) ? 'groupcourseid' : 'courseid';
$eventtypes = calendar_get_all_allowed_types();
$eventtype = isset($data['eventtype']) ? $data['eventtype'] : null;

$coursekey = ($eventtype == 'group') ? 'groupcourseid' : 'courseid';
if (empty($eventtype) || !isset($eventtypes[$eventtype])) {
$errors['eventtype'] = get_string('invalideventtype', 'calendar');
}
Expand Down
19 changes: 19 additions & 0 deletions calendar/tests/behat/calendar.feature
Expand Up @@ -154,3 +154,22 @@ Feature: Perform basic calendar functionality
When I click on "Go to activity" "link"
And I wait to be redirected
Then I should see "Test choice"

@javascript
Scenario: Attempt to create event without fill required fields should display validation errors
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "This month"
And I click on "New event" "button"
When I click on "Save" "button"
Then I should see "Required"
And I am on site homepage
And I follow "Calendar"
And I click on "New event" "button"
And I set the field "Type of event" to "Course"
When I click on "Save" "button"
Then I should see "Required"
And I should see "Select a course"
And I set the field "Event title" to "Really awesome event!"
When I click on "Save" "button"
Then I should see "Select a course"

0 comments on commit f883974

Please sign in to comment.