/** * Test reopen plan. */ public function test_reopen_plan() { $syscontext = context_system::instance(); $this->setUser($this->creator); $this->setUser($this->user); assign_capability('moodle/competency:planmanageowndraft', CAP_ALLOW, $this->userrole, $syscontext->id); assign_capability('moodle/competency:planmanageown', CAP_ALLOW, $this->userrole, $syscontext->id); accesslib_clear_all_caches_for_unit_testing(); $this->setUser($this->user); $plan = $this->create_plan(1, $this->user->id, 0, plan::STATUS_ACTIVE, 0); external::complete_plan($plan->id); $result = external::reopen_plan($plan->id); $this->assertTrue($result); }