当前位置: 首页>>代码示例>>PHP>>正文


PHP api::plan_start_review方法代码示例

本文整理汇总了PHP中core_competency\api::plan_start_review方法的典型用法代码示例。如果您正苦于以下问题:PHP api::plan_start_review方法的具体用法?PHP api::plan_start_review怎么用?PHP api::plan_start_review使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core_competency\api的用法示例。


在下文中一共展示了api::plan_start_review方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: plan_start_review

 /**
  * External function plan_start_review.
  *
  * @param int $id The plan ID.
  * @return boolean
  */
 public static function plan_start_review($id)
 {
     $params = self::validate_parameters(self::plan_start_review_parameters(), array('id' => $id));
     $plan = api::read_plan($id);
     self::validate_context($plan->get_context());
     return api::plan_start_review($plan);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:13,代码来源:external.php

示例2: test_plan_start_review

 /**
  * Testing starting the review.
  */
 public function test_plan_start_review()
 {
     $data = $this->setup_workflow_data();
     $dg = $data['dg'];
     $lpg = $data['lpg'];
     $user = $data['user'];
     $reviewer = $data['reviewer'];
     $otheruser = $data['otheruser'];
     $plan = $data['plan'];
     $tplplan = $data['tplplan'];
     // Set waiting for review.
     $tplplan->set_status(plan::STATUS_WAITING_FOR_REVIEW);
     $tplplan->update();
     $plan->set_status(plan::STATUS_WAITING_FOR_REVIEW);
     $plan->update();
     // Foreign user cannot do anything.
     $this->setUser($otheruser);
     try {
         api::plan_start_review($plan);
         $this->fail('The user can not read the plan.');
     } catch (required_capability_exception $e) {
         $this->assertEquals('nopermissions', $e->errorcode);
     }
     // Can not change a plan based on a template.
     $this->setUser($reviewer);
     try {
         api::plan_start_review($tplplan);
         $this->fail('The plan is based on a template.');
     } catch (coding_exception $e) {
         $this->assertRegExp('/Template plans cannot be reviewed./', $e->getMessage());
     }
     // Can not start a review when not waiting for review.
     $this->setUser($reviewer);
     $plan->set_status(plan::STATUS_DRAFT);
     try {
         api::plan_start_review($plan);
         $this->fail('The plan review cannot be started at this stage.');
     } catch (coding_exception $e) {
         $this->assertRegExp('/The plan review cannot be started at this stage./', $e->getMessage());
     }
     // Can not start a review when not waiting for review.
     $this->setUser($reviewer);
     $plan->set_status(plan::STATUS_IN_REVIEW);
     try {
         api::plan_start_review($plan);
         $this->fail('The plan review cannot be started at this stage.');
     } catch (coding_exception $e) {
         $this->assertRegExp('/The plan review cannot be started at this stage./', $e->getMessage());
     }
     // Can not start a review when not waiting for review.
     $this->setUser($reviewer);
     $plan->set_status(plan::STATUS_ACTIVE);
     try {
         api::plan_start_review($plan);
         $this->fail('The plan review cannot be started at this stage.');
     } catch (coding_exception $e) {
         $this->assertRegExp('/The plan review cannot be started at this stage./', $e->getMessage());
     }
     // Can not start a review when not waiting for review.
     $this->setUser($reviewer);
     $plan->set_status(plan::STATUS_COMPLETE);
     try {
         api::plan_start_review($plan);
         $this->fail('The plan review cannot be started at this stage.');
     } catch (coding_exception $e) {
         $this->assertRegExp('/The plan review cannot be started at this stage./', $e->getMessage());
     }
     // Starting as the owner.
     $this->setUser($user);
     $plan->set_status(plan::STATUS_WAITING_FOR_REVIEW);
     try {
         api::plan_start_review($plan);
         $this->fail('The user can not start a review.');
     } catch (required_capability_exception $e) {
         $this->assertEquals('nopermissions', $e->errorcode);
     }
     // Starting review.
     $this->setUser($reviewer);
     api::plan_start_review($plan);
     $plan->read();
     $this->assertEquals(plan::STATUS_IN_REVIEW, $plan->get_status());
     $this->assertEquals($reviewer->id, $plan->get_reviewerid());
     // Starting review by ID.
     $plan->set_status(plan::STATUS_WAITING_FOR_REVIEW);
     $plan->set_reviewerid(null);
     $plan->update();
     api::plan_start_review($plan->get_id());
     $plan->read();
     $this->assertEquals(plan::STATUS_IN_REVIEW, $plan->get_status());
     $this->assertEquals($reviewer->id, $plan->get_reviewerid());
 }
开发者ID:dg711,项目名称:moodle,代码行数:94,代码来源:api_test.php

示例3: test_plan_review_started

 /**
  * Test the plan review started event.
  *
  */
 public function test_plan_review_started()
 {
     $this->resetAfterTest(true);
     $this->setAdminUser();
     $dg = $this->getDataGenerator();
     $lpg = $this->getDataGenerator()->get_plugin_generator('core_competency');
     $user1 = $dg->create_user();
     $plan = $lpg->create_plan(array('userid' => $user1->id, 'status' => \core_competency\plan::STATUS_WAITING_FOR_REVIEW));
     $planid = $plan->get_id();
     $contextid = $plan->get_context()->id;
     // Trigger and capture the event.
     $sink = $this->redirectEvents();
     $result = api::plan_start_review($plan->get_id());
     $this->assertTrue($result);
     // Get our event event.
     $events = $sink->get_events();
     $event = reset($events);
     $this->assertInstanceOf('\\core\\event\\competency_plan_review_started', $event);
     $this->assertEquals($planid, $event->objectid);
     $this->assertEquals($contextid, $event->contextid);
     $this->assertEquals($plan->get_userid(), $event->relateduserid);
     $this->assertEventContextNotUsed($event);
     $this->assertDebuggingNotCalled();
 }
开发者ID:evltuma,项目名称:moodle,代码行数:28,代码来源:event_test.php


注:本文中的core_competency\api::plan_start_review方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。