File tree 2 files changed +20
-2
lines changed
classes/local/event/forms
2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -119,10 +119,9 @@ public function validation($data, $files) {
119
119
global $ DB , $ CFG ;
120
120
121
121
$ errors = parent ::validation ($ data , $ files );
122
- $ coursekey = isset ($ data ['groupcourseid ' ]) ? 'groupcourseid ' : 'courseid ' ;
123
122
$ eventtypes = calendar_get_all_allowed_types ();
124
123
$ eventtype = isset ($ data ['eventtype ' ]) ? $ data ['eventtype ' ] : null ;
125
-
124
+ $ coursekey = ( $ eventtype == ' group ' ) ? ' groupcourseid ' : ' courseid ' ;
126
125
if (empty ($ eventtype ) || !isset ($ eventtypes [$ eventtype ])) {
127
126
$ errors ['eventtype ' ] = get_string ('invalideventtype ' , 'calendar ' );
128
127
}
Original file line number Diff line number Diff line change @@ -154,3 +154,22 @@ Feature: Perform basic calendar functionality
154
154
When I click on "Go to activity" "link"
155
155
And I wait to be redirected
156
156
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"
You can’t perform that action at this time.
0 commit comments