MDL-39723 prevent update_courses() bad habits.
MDL-39723 prevent update_courses() bad habits.

All the external functions end calling require_login() that is
always in charge of setting the $COURSE global. This is not a
problem, but in the case of core_course_external::update_courses()
testing, where we are, in the same "request", both setting and getting
the $COURSE information and it's clearly outdated, so the test fails.

Alternative solution would be to modify the external function to ensure
that, after updating a course, $COURSE is also updated with the changes
but it does not seem to be necessary for "normal" usage (both UI/WS POVs).

dilawar/moodle