Exemplo n.º 1
0
    /**
     * Setup testing environment
     */
    protected function setUp() {
        parent::setUser();
        $cm             = new stdclass();
        $course         = new stdclass();
        $context        = new stdclass();
        $workshop       = (object)array('id' => 42, 'strategy' => 'rubric');
        $this->workshop = new workshop($workshop, $cm, $course, $context);
        $this->strategy = new testable_workshop_rubric_strategy($this->workshop);

        // prepare dimensions definition
        $dim = new stdclass();
        $dim->id = 6;
        $dim->levels[10] = (object)array('id' => 10, 'grade' => 0);
        $dim->levels[13] = (object)array('id' => 13, 'grade' => 2);
        $dim->levels[14] = (object)array('id' => 14, 'grade' => 6);
        $dim->levels[16] = (object)array('id' => 16, 'grade' => 8);
        $this->strategy->dimensions[$dim->id] = $dim;

        $dim = new stdclass();
        $dim->id = 8;
        $dim->levels[17] = (object)array('id' => 17, 'grade' => 0);
        $dim->levels[18] = (object)array('id' => 18, 'grade' => 1);
        $dim->levels[19] = (object)array('id' => 19, 'grade' => 2);
        $dim->levels[20] = (object)array('id' => 20, 'grade' => 3);
        $this->strategy->dimensions[$dim->id] = $dim;

        $dim = new stdclass();
        $dim->id = 10;
        $dim->levels[27] = (object)array('id' => 27, 'grade' => 10);
        $dim->levels[28] = (object)array('id' => 28, 'grade' => 20);
        $dim->levels[29] = (object)array('id' => 29, 'grade' => 30);
        $dim->levels[30] = (object)array('id' => 30, 'grade' => 40);
        $this->strategy->dimensions[$dim->id] = $dim;

    }
 /**
  * login the given user and return ratingallocate object for him.
  *
  * @param advanced_testcase $tc
  * @param unknown $ratingallocate_db db object representing ratingallocate object
  * @param unknown $user
  * @return ratingallocate
  */
 public static function get_ratingallocate_for_user(advanced_testcase $tc, $ratingallocate_db, $user)
 {
     $tc->setUser($user);
     $cm = get_coursemodule_from_instance(ratingallocate_MOD_NAME, $ratingallocate_db->{this_db\ratingallocate::ID});
     $course = get_course($cm->course);
     $context = context_module::instance($cm->id);
     return new ratingallocate($ratingallocate_db, $course, $cm, $context);
 }
Exemplo n.º 3
0
 public function setUp() {
     parent::setUser();
     $this->resetAfterTest();
     $this->testpage = new testable_moodle_page();
 }