Moodle course unit tests. Code reorganization