當前位置: 首頁>>代碼示例>>PHP>>正文


PHP advanced_testcase::setUser方法代碼示例

本文整理匯總了PHP中advanced_testcase::setUser方法的典型用法代碼示例。如果您正苦於以下問題:PHP advanced_testcase::setUser方法的具體用法?PHP advanced_testcase::setUser怎麽用?PHP advanced_testcase::setUser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在advanced_testcase的用法示例。


在下文中一共展示了advanced_testcase::setUser方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setUp

    /**
     * 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;

    }
開發者ID:numbas,項目名稱:moodle,代碼行數:38,代碼來源:lib_test.php

示例2: get_ratingallocate_for_user

 /**
  * 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);
 }
開發者ID:andrewhancox,項目名稱:moodle-mod_ratingallocate,代碼行數:16,代碼來源:lib.php

示例3: setUp

 public function setUp() {
     parent::setUser();
     $this->resetAfterTest();
     $this->testpage = new testable_moodle_page();
 }
開發者ID:numbas,項目名稱:moodle,代碼行數:5,代碼來源:pagelib_test.php


注:本文中的advanced_testcase::setUser方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。