MDL-39956 cohort: convert to new events

* \core\event\cohort_created
* \core\event\cohort_updated
* \core\event\cohort_deleted
* \core\event\cohort_member_added
* \core\event\cohort_member_removed
MDL-39956 Use the new events in library functions.

HACK HACK HACK - userid and contextid are not validated
MDL-39956 cohort: add tests for new events