/**
     * Adapter to modules generator
     * @throws Exception Custom exception for test writers
     * @param array $data
     * @return void
     */
    protected function process_activity($data) {
        global $DB, $CFG;

        // The the_following_exists() method checks that the field exists.
        $activityname = $data['activity'];
        unset($data['activity']);

        // Convert scale name into scale id (negative number indicates using scale).
        if (isset($data['grade']) && strlen($data['grade']) && !is_number($data['grade'])) {
            $data['grade'] = - $this->get_scale_id($data['grade']);
            require_once("$CFG->libdir/grade/constants.php");

            if (!isset($data['gradetype'])) {
                $data['gradetype'] = GRADE_TYPE_SCALE;
            }
        }

        // We split $data in the activity $record and the course module $options.
        $cmoptions = array();
        $cmcolumns = $DB->get_columns('course_modules');
        foreach ($cmcolumns as $key => $value) {
            if (isset($data[$key])) {
                $cmoptions[$key] = $data[$key];
            }
        }

        // Custom exception.
        try {
            $this->datagenerator->create_module($activityname, $data, $cmoptions);
        } catch (coding_exception $e) {
            throw new Exception('\'' . $activityname . '\' activity can not be added using this step,' .
                ' use the step \'I add a "ACTIVITY_OR_RESOURCE_NAME_STRING" to section "SECTION_NUMBER"\' instead');
        }
    }
 /**
  * Adapter to modules generator
  * @throws Exception Custom exception for test writers
  * @param array $data
  * @return void
  */
 protected function process_activity($data)
 {
     global $DB;
     // The the_following_exists() method checks that the field exists.
     $activityname = $data['activity'];
     unset($data['activity']);
     // We split $data in the activity $record and the course module $options.
     $cmoptions = array();
     $cmcolumns = $DB->get_columns('course_modules');
     foreach ($cmcolumns as $key => $value) {
         if (isset($data[$key])) {
             $cmoptions[$key] = $data[$key];
         }
     }
     // Custom exception.
     try {
         $this->datagenerator->create_module($activityname, $data, $cmoptions);
     } catch (coding_exception $e) {
         throw new Exception('\'' . $activityname . '\' activity can not be added using this step,' . ' use the step \'I add a "ACTIVITY_OR_RESOURCE_NAME_STRING" to section "SECTION_NUMBER"\' instead');
     }
 }