MDL-41157 calendar: add unit tests for calendar_get_course_cached
MDL-41157 calendar: improve calendar_get_course_cached

The function get_course() introduced in 2.5.1 will use $COURSE and
$SITE to avoid an uncessary DB query, simplifying the logic of this
function and improving perf.