File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
classes/local/event/forms Expand file tree Collapse file tree 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) {
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 }
Original file line number Diff line number Diff 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"
You can’t perform that action at this time.
0 commit comments