Ejemplo n.º 1
0
 /**
  * Test we can duplicate learning plan template.
  */
 public function test_duplicate_learning_plan_template()
 {
     $this->setUser($this->creator);
     $syscontext = context_system::instance();
     $onehour = time() + 60 * 60;
     // Create a template.
     $template = $this->create_template(1, true);
     // Create a competency framework.
     $framework = $this->create_competency_framework(1, true);
     // Create multiple competencies.
     $competency1 = $this->create_competency(1, $framework->id);
     $competency2 = $this->create_competency(2, $framework->id);
     $competency3 = $this->create_competency(3, $framework->id);
     // Add the competencies.
     external::add_competency_to_template($template->id, $competency1->id);
     external::add_competency_to_template($template->id, $competency2->id);
     external::add_competency_to_template($template->id, $competency3->id);
     // Duplicate the learning plan template.
     $duplicatedtemplate = external::duplicate_template($template->id);
     $result = external::list_competencies_in_template($template->id);
     $resultduplicated = external::list_competencies_in_template($duplicatedtemplate->id);
     $this->assertEquals(count($result), count($resultduplicated));
     $this->assertContains($template->shortname, $duplicatedtemplate->shortname);
     $this->assertEquals($duplicatedtemplate->description, $template->description);
     $this->assertEquals($duplicatedtemplate->descriptionformat, $template->descriptionformat);
     $this->assertEquals($duplicatedtemplate->visible, $template->visible);
 }