MDL-42294 course: fixed delete script ordering

Added a behat test for the creation and deletion of a new course.
This should turn up any such errors like this during automated
testing in the future.