/** * This function tests the date_restriction() method. The method returns T/F depending * on if a date restriction exists. */ public function test_date_restriction() { $sgs = new skills_group_setting($this->courseid); $sgs->update_record($this->get_skills_group_settings()); $this->assertFalse((bool) $sgs->date_restriction()); $sgs->update_record($this->get_skills_group_settings(1, time())); $this->assertTrue((bool) $sgs->date_restriction()); }
/** * This function configures the skills_group_setting class for further testing. I do not call this * on the setUp() function here, but derived testing classes can do so as needed. * * @param integer $threshold low/high score threshold * @param integer $date date in unix epoch format * @param integer $allownaming whether students can name their groups (1) or not (0) */ protected function configure_settings($threshold = 1, $date = null, $allownaming = 1) { $sgs = new skills_group_setting($this->courseid); $settings = $this->get_skills_group_settings($threshold, $date, $allownaming); $sgs->update_record($settings); // Set last student to have choice locked. $student = new skills_group_student($this->courseid, $this->users[self::NUMBEROFUSERS - 1]->id); $student->set_lock_choice(true); }
/** * This function processes the submitted form by saving the IDs of the feedback activity * and the grouping. * * @param int $courseid The ID of the course. * @param object $submittedform Object holding the submitted data by the user. * */ function process_form($courseid, &$submittedform) { global $DB; $sgs = new skills_group_setting($courseid); $sgs->update_record($submittedform); }