当前位置: 首页>>代码示例>>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;未经允许,请勿转载。