Skip to content

Commit 69ae176

Browse files
author
David Monllao
committed
Merge branch 'MDL-62813-34' of git://github.com/lameze/moodle into MOODLE_34_STABLE
2 parents 6fef4bf + 2a643b0 commit 69ae176

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

calendar/classes/local/event/forms/create.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,9 @@ public function validation($data, $files) {
119119
global $DB, $CFG;
120120

121121
$errors = parent::validation($data, $files);
122-
$coursekey = isset($data['groupcourseid']) ? 'groupcourseid' : 'courseid';
123122
$eventtypes = calendar_get_all_allowed_types();
124123
$eventtype = isset($data['eventtype']) ? $data['eventtype'] : null;
125-
124+
$coursekey = ($eventtype == 'group') ? 'groupcourseid' : 'courseid';
126125
if (empty($eventtype) || !isset($eventtypes[$eventtype])) {
127126
$errors['eventtype'] = get_string('invalideventtype', 'calendar');
128127
}

calendar/tests/behat/calendar.feature

+19
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,22 @@ Feature: Perform basic calendar functionality
154154
When I click on "Go to activity" "link"
155155
And I wait to be redirected
156156
Then I should see "Test choice"
157+
158+
@javascript
159+
Scenario: Attempt to create event without fill required fields should display validation errors
160+
Given I log in as "teacher1"
161+
And I am on "Course 1" course homepage
162+
And I follow "This month"
163+
And I click on "New event" "button"
164+
When I click on "Save" "button"
165+
Then I should see "Required"
166+
And I am on site homepage
167+
And I follow "Calendar"
168+
And I click on "New event" "button"
169+
And I set the field "Type of event" to "Course"
170+
When I click on "Save" "button"
171+
Then I should see "Required"
172+
And I should see "Select a course"
173+
And I set the field "Event title" to "Really awesome event!"
174+
When I click on "Save" "button"
175+
Then I should see "Select a course"

0 commit comments

Comments
 (0)