| 1 | 
           efrain | 
           1 | 
           <?php
  | 
        
        
            | 
            | 
           2 | 
           // This file is part of Moodle - http://moodle.org/
  | 
        
        
            | 
            | 
           3 | 
           //
  | 
        
        
            | 
            | 
           4 | 
           // Moodle is free software: you can redistribute it and/or modify
  | 
        
        
            | 
            | 
           5 | 
           // it under the terms of the GNU General Public License as published by
  | 
        
        
            | 
            | 
           6 | 
           // the Free Software Foundation, either version 3 of the License, or
  | 
        
        
            | 
            | 
           7 | 
           // (at your option) any later version.
  | 
        
        
            | 
            | 
           8 | 
           //
  | 
        
        
            | 
            | 
           9 | 
           // Moodle is distributed in the hope that it will be useful,
  | 
        
        
            | 
            | 
           10 | 
           // but WITHOUT ANY WARRANTY; without even the implied warranty of
  | 
        
        
            | 
            | 
           11 | 
           // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  | 
        
        
            | 
            | 
           12 | 
           // GNU General Public License for more details.
  | 
        
        
            | 
            | 
           13 | 
           //
  | 
        
        
            | 
            | 
           14 | 
           // You should have received a copy of the GNU General Public License
  | 
        
        
            | 
            | 
           15 | 
           // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  | 
        
        
            | 
            | 
           16 | 
              | 
        
        
            | 
            | 
           17 | 
           namespace core_competency;
  | 
        
        
            | 
            | 
           18 | 
              | 
        
        
            | 
            | 
           19 | 
           /**
  | 
        
        
            | 
            | 
           20 | 
            * Tool LP data generator testcase.
  | 
        
        
            | 
            | 
           21 | 
            *
  | 
        
        
            | 
            | 
           22 | 
            * @package    core_competency
  | 
        
        
            | 
            | 
           23 | 
            * @category   test
  | 
        
        
            | 
            | 
           24 | 
            * @copyright  2015 Frédéric Massart - FMCorz.net
  | 
        
        
            | 
            | 
           25 | 
            * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  | 
        
        
            | 
            | 
           26 | 
            */
  | 
        
        
            | 
            | 
           27 | 
           class generator_test extends \advanced_testcase {
  | 
        
        
            | 
            | 
           28 | 
              | 
        
        
           | 11 | 
           efrain | 
           29 | 
               public function test_create_framework(): void {
  | 
        
        
           | 1 | 
           efrain | 
           30 | 
                   $this->resetAfterTest(true);
  | 
        
        
            | 
            | 
           31 | 
              | 
        
        
            | 
            | 
           32 | 
                   $lpg = $this->getDataGenerator()->get_plugin_generator('core_competency');
  | 
        
        
            | 
            | 
           33 | 
                   $this->assertEquals(0, competency_framework::count_records());
  | 
        
        
            | 
            | 
           34 | 
                   $framework = $lpg->create_framework();
  | 
        
        
            | 
            | 
           35 | 
                   $framework = $lpg->create_framework();
  | 
        
        
            | 
            | 
           36 | 
                   $this->assertEquals(2, competency_framework::count_records());
  | 
        
        
            | 
            | 
           37 | 
                   $this->assertInstanceOf('\core_competency\competency_framework', $framework);
  | 
        
        
            | 
            | 
           38 | 
               }
  | 
        
        
            | 
            | 
           39 | 
              | 
        
        
           | 11 | 
           efrain | 
           40 | 
               public function test_create_competency(): void {
  | 
        
        
           | 1 | 
           efrain | 
           41 | 
                   $this->resetAfterTest(true);
  | 
        
        
            | 
            | 
           42 | 
              | 
        
        
            | 
            | 
           43 | 
                   $lpg = $this->getDataGenerator()->get_plugin_generator('core_competency');
  | 
        
        
            | 
            | 
           44 | 
                   $framework = $lpg->create_framework();
  | 
        
        
            | 
            | 
           45 | 
                   $this->assertEquals(0, competency::count_records());
  | 
        
        
            | 
            | 
           46 | 
                   $competency = $lpg->create_competency(array('competencyframeworkid' => $framework->get('id')));
  | 
        
        
            | 
            | 
           47 | 
                   $competency = $lpg->create_competency(array('competencyframeworkid' => $framework->get('id')));
  | 
        
        
            | 
            | 
           48 | 
                   $this->assertEquals(2, competency::count_records());
  | 
        
        
            | 
            | 
           49 | 
                   $this->assertInstanceOf('\core_competency\competency', $competency);
  | 
        
        
            | 
            | 
           50 | 
               }
  | 
        
        
            | 
            | 
           51 | 
              | 
        
        
           | 11 | 
           efrain | 
           52 | 
               public function test_create_related_competency(): void {
  | 
        
        
           | 1 | 
           efrain | 
           53 | 
                   $this->resetAfterTest(true);
  | 
        
        
            | 
            | 
           54 | 
              | 
        
        
            | 
            | 
           55 | 
                   $lpg = $this->getDataGenerator()->get_plugin_generator('core_competency');
  | 
        
        
            | 
            | 
           56 | 
                   $framework = $lpg->create_framework();
  | 
        
        
            | 
            | 
           57 | 
                   $c1 = $lpg->create_competency(array('competencyframeworkid' => $framework->get('id')));
  | 
        
        
            | 
            | 
           58 | 
                   $c2 = $lpg->create_competency(array('competencyframeworkid' => $framework->get('id')));
  | 
        
        
            | 
            | 
           59 | 
                   $c3 = $lpg->create_competency(array('competencyframeworkid' => $framework->get('id')));
  | 
        
        
            | 
            | 
           60 | 
                   $this->assertEquals(0, related_competency::count_records());
  | 
        
        
            | 
            | 
           61 | 
                   $rc = $lpg->create_related_competency(array('competencyid' => $c1->get('id'), 'relatedcompetencyid' => $c2->get('id')));
  | 
        
        
            | 
            | 
           62 | 
                   $rc = $lpg->create_related_competency(array('competencyid' => $c2->get('id'), 'relatedcompetencyid' => $c3->get('id')));
  | 
        
        
            | 
            | 
           63 | 
                   $this->assertEquals(2, related_competency::count_records());
  | 
        
        
            | 
            | 
           64 | 
                   $this->assertInstanceOf('\core_competency\related_competency', $rc);
  | 
        
        
            | 
            | 
           65 | 
               }
  | 
        
        
            | 
            | 
           66 | 
              | 
        
        
           | 11 | 
           efrain | 
           67 | 
               public function test_create_plan(): void {
  | 
        
        
           | 1 | 
           efrain | 
           68 | 
                   $this->resetAfterTest(true);
  | 
        
        
            | 
            | 
           69 | 
              | 
        
        
            | 
            | 
           70 | 
                   $user = $this->getDataGenerator()->create_user();
  | 
        
        
            | 
            | 
           71 | 
                   $lpg = $this->getDataGenerator()->get_plugin_generator('core_competency');
  | 
        
        
            | 
            | 
           72 | 
                   $this->assertEquals(0, plan::count_records());
  | 
        
        
            | 
            | 
           73 | 
                   $plan = $lpg->create_plan(array('userid' => $user->id));
  | 
        
        
            | 
            | 
           74 | 
                   $this->assertEquals(1, plan::count_records());
  | 
        
        
            | 
            | 
           75 | 
                   $this->assertInstanceOf('\core_competency\plan', $plan);
  | 
        
        
            | 
            | 
           76 | 
               }
  | 
        
        
            | 
            | 
           77 | 
              | 
        
        
           | 11 | 
           efrain | 
           78 | 
               public function test_create_user_competency(): void {
  | 
        
        
           | 1 | 
           efrain | 
           79 | 
                   $this->resetAfterTest(true);
  | 
        
        
            | 
            | 
           80 | 
              | 
        
        
            | 
            | 
           81 | 
                   $user = $this->getDataGenerator()->create_user();
  | 
        
        
            | 
            | 
           82 | 
                   $lpg = $this->getDataGenerator()->get_plugin_generator('core_competency');
  | 
        
        
            | 
            | 
           83 | 
                   $framework = $lpg->create_framework();
  | 
        
        
            | 
            | 
           84 | 
                   $c1 = $lpg->create_competency(array('competencyframeworkid' => $framework->get('id')));
  | 
        
        
            | 
            | 
           85 | 
                   $c2 = $lpg->create_competency(array('competencyframeworkid' => $framework->get('id')));
  | 
        
        
            | 
            | 
           86 | 
                   $c3 = $lpg->create_competency(array('competencyframeworkid' => $framework->get('id')));
  | 
        
        
            | 
            | 
           87 | 
                   $this->assertEquals(0, user_competency::count_records());
  | 
        
        
            | 
            | 
           88 | 
                   $rc = $lpg->create_user_competency(array('userid' => $user->id, 'competencyid' => $c1->get('id')));
  | 
        
        
            | 
            | 
           89 | 
                   $rc = $lpg->create_user_competency(array('userid' => $user->id, 'competencyid' => $c2->get('id')));
  | 
        
        
            | 
            | 
           90 | 
                   $this->assertEquals(2, user_competency::count_records());
  | 
        
        
            | 
            | 
           91 | 
                   $this->assertInstanceOf('\core_competency\user_competency', $rc);
  | 
        
        
            | 
            | 
           92 | 
               }
  | 
        
        
            | 
            | 
           93 | 
              | 
        
        
           | 11 | 
           efrain | 
           94 | 
               public function test_create_user_competency_plan(): void {
  | 
        
        
           | 1 | 
           efrain | 
           95 | 
                   $this->resetAfterTest(true);
  | 
        
        
            | 
            | 
           96 | 
              | 
        
        
            | 
            | 
           97 | 
                   $user = $this->getDataGenerator()->create_user();
  | 
        
        
            | 
            | 
           98 | 
                   $lpg = $this->getDataGenerator()->get_plugin_generator('core_competency');
  | 
        
        
            | 
            | 
           99 | 
                   $framework = $lpg->create_framework();
  | 
        
        
            | 
            | 
           100 | 
                   $c1 = $lpg->create_competency(array('competencyframeworkid' => $framework->get('id')));
  | 
        
        
            | 
            | 
           101 | 
                   $c2 = $lpg->create_competency(array('competencyframeworkid' => $framework->get('id')));
  | 
        
        
            | 
            | 
           102 | 
                   $plan = $lpg->create_plan(array('userid' => $user->id));
  | 
        
        
            | 
            | 
           103 | 
                   $this->assertEquals(0, user_competency_plan::count_records());
  | 
        
        
            | 
            | 
           104 | 
                   $ucp = $lpg->create_user_competency_plan(array(
  | 
        
        
            | 
            | 
           105 | 
                                                                'userid' => $user->id,
  | 
        
        
            | 
            | 
           106 | 
                                                                'competencyid' => $c1->get('id'),
  | 
        
        
            | 
            | 
           107 | 
                                                                'planid' => $plan->get('id')
  | 
        
        
            | 
            | 
           108 | 
                                                           ));
  | 
        
        
            | 
            | 
           109 | 
                   $ucp = $lpg->create_user_competency_plan(array(
  | 
        
        
            | 
            | 
           110 | 
                                                                'userid' => $user->id,
  | 
        
        
            | 
            | 
           111 | 
                                                                'competencyid' => $c2->get('id'),
  | 
        
        
            | 
            | 
           112 | 
                                                                'planid' => $plan->get('id')
  | 
        
        
            | 
            | 
           113 | 
                                                           ));
  | 
        
        
            | 
            | 
           114 | 
                   $this->assertEquals(2, user_competency_plan::count_records());
  | 
        
        
            | 
            | 
           115 | 
                   $this->assertInstanceOf('\core_competency\user_competency_plan', $ucp);
  | 
        
        
            | 
            | 
           116 | 
               }
  | 
        
        
            | 
            | 
           117 | 
              | 
        
        
           | 11 | 
           efrain | 
           118 | 
               public function test_create_template(): void {
  | 
        
        
           | 1 | 
           efrain | 
           119 | 
                   $this->resetAfterTest(true);
  | 
        
        
            | 
            | 
           120 | 
              | 
        
        
            | 
            | 
           121 | 
                   $lpg = $this->getDataGenerator()->get_plugin_generator('core_competency');
  | 
        
        
            | 
            | 
           122 | 
                   $this->assertEquals(0, template::count_records());
  | 
        
        
            | 
            | 
           123 | 
                   $template = $lpg->create_template();
  | 
        
        
            | 
            | 
           124 | 
                   $template = $lpg->create_template();
  | 
        
        
            | 
            | 
           125 | 
                   $this->assertEquals(2, template::count_records());
  | 
        
        
            | 
            | 
           126 | 
                   $this->assertInstanceOf('\core_competency\template', $template);
  | 
        
        
            | 
            | 
           127 | 
               }
  | 
        
        
            | 
            | 
           128 | 
              | 
        
        
           | 11 | 
           efrain | 
           129 | 
               public function test_create_template_competency(): void {
  | 
        
        
           | 1 | 
           efrain | 
           130 | 
                   $this->resetAfterTest(true);
  | 
        
        
            | 
            | 
           131 | 
                   $lpg = $this->getDataGenerator()->get_plugin_generator('core_competency');
  | 
        
        
            | 
            | 
           132 | 
              | 
        
        
            | 
            | 
           133 | 
                   $this->assertEquals(0, template_competency::count_records());
  | 
        
        
            | 
            | 
           134 | 
                   $framework = $lpg->create_framework();
  | 
        
        
            | 
            | 
           135 | 
                   $c1 = $lpg->create_competency(array('competencyframeworkid' => $framework->get('id')));
  | 
        
        
            | 
            | 
           136 | 
                   $c2 = $lpg->create_competency(array('competencyframeworkid' => $framework->get('id')));
  | 
        
        
            | 
            | 
           137 | 
                   $template = $lpg->create_template();
  | 
        
        
            | 
            | 
           138 | 
                   $relation = $lpg->create_template_competency(array('competencyid' => $c1->get('id'), 'templateid' => $template->get('id')));
  | 
        
        
            | 
            | 
           139 | 
                   $relation = $lpg->create_template_competency(array('competencyid' => $c2->get('id'), 'templateid' => $template->get('id')));
  | 
        
        
            | 
            | 
           140 | 
                   $this->assertEquals(2, template_competency::count_records());
  | 
        
        
            | 
            | 
           141 | 
                   $this->assertInstanceOf('\core_competency\template_competency', $relation);
  | 
        
        
            | 
            | 
           142 | 
               }
  | 
        
        
            | 
            | 
           143 | 
              | 
        
        
           | 11 | 
           efrain | 
           144 | 
               public function test_create_plan_competency(): void {
  | 
        
        
           | 1 | 
           efrain | 
           145 | 
                   $this->resetAfterTest(true);
  | 
        
        
            | 
            | 
           146 | 
                   $user = $this->getDataGenerator()->create_user();
  | 
        
        
            | 
            | 
           147 | 
                   $lpg = $this->getDataGenerator()->get_plugin_generator('core_competency');
  | 
        
        
            | 
            | 
           148 | 
              | 
        
        
            | 
            | 
           149 | 
                   $framework = $lpg->create_framework();
  | 
        
        
            | 
            | 
           150 | 
                   $c1 = $lpg->create_competency(array('competencyframeworkid' => $framework->get('id')));
  | 
        
        
            | 
            | 
           151 | 
                   $c2 = $lpg->create_competency(array('competencyframeworkid' => $framework->get('id')));
  | 
        
        
            | 
            | 
           152 | 
              | 
        
        
            | 
            | 
           153 | 
                   $plan = $lpg->create_plan(array('userid' => $user->id));
  | 
        
        
            | 
            | 
           154 | 
              | 
        
        
            | 
            | 
           155 | 
                   $pc1 = $lpg->create_plan_competency(array('planid' => $plan->get('id'), 'competencyid' => $c1->get('id')));
  | 
        
        
            | 
            | 
           156 | 
                   $pc2 = $lpg->create_plan_competency(array('planid' => $plan->get('id'), 'competencyid' => $c2->get('id')));
  | 
        
        
            | 
            | 
           157 | 
              | 
        
        
            | 
            | 
           158 | 
                   $this->assertEquals(2, plan_competency::count_records());
  | 
        
        
            | 
            | 
           159 | 
                   $this->assertInstanceOf('\core_competency\plan_competency', $pc1);
  | 
        
        
            | 
            | 
           160 | 
                   $this->assertInstanceOf('\core_competency\plan_competency', $pc2);
  | 
        
        
            | 
            | 
           161 | 
                   $this->assertEquals($plan->get('id'), $pc1->get('planid'));
  | 
        
        
            | 
            | 
           162 | 
               }
  | 
        
        
            | 
            | 
           163 | 
              | 
        
        
           | 11 | 
           efrain | 
           164 | 
               public function test_create_template_cohort(): void {
  | 
        
        
           | 1 | 
           efrain | 
           165 | 
                   $this->resetAfterTest(true);
  | 
        
        
            | 
            | 
           166 | 
              | 
        
        
            | 
            | 
           167 | 
                   $lpg = $this->getDataGenerator()->get_plugin_generator('core_competency');
  | 
        
        
            | 
            | 
           168 | 
                   $c1 = $this->getDataGenerator()->create_cohort();
  | 
        
        
            | 
            | 
           169 | 
                   $c2 = $this->getDataGenerator()->create_cohort();
  | 
        
        
            | 
            | 
           170 | 
                   $t1 = $lpg->create_template();
  | 
        
        
            | 
            | 
           171 | 
                   $this->assertEquals(0, template_cohort::count_records());
  | 
        
        
            | 
            | 
           172 | 
                   $tc = $lpg->create_template_cohort(array('templateid' => $t1->get('id'), 'cohortid' => $c1->id));
  | 
        
        
            | 
            | 
           173 | 
                   $this->assertEquals(1, template_cohort::count_records());
  | 
        
        
            | 
            | 
           174 | 
                   $tc = $lpg->create_template_cohort(array('templateid' => $t1->get('id'), 'cohortid' => $c2->id));
  | 
        
        
            | 
            | 
           175 | 
                   $this->assertEquals(2, template_cohort::count_records());
  | 
        
        
            | 
            | 
           176 | 
                   $this->assertInstanceOf('\core_competency\template_cohort', $tc);
  | 
        
        
            | 
            | 
           177 | 
               }
  | 
        
        
            | 
            | 
           178 | 
              | 
        
        
           | 11 | 
           efrain | 
           179 | 
               public function test_create_evidence(): void {
  | 
        
        
           | 1 | 
           efrain | 
           180 | 
                   $this->resetAfterTest(true);
  | 
        
        
            | 
            | 
           181 | 
              | 
        
        
            | 
            | 
           182 | 
                   $user = $this->getDataGenerator()->create_user();
  | 
        
        
            | 
            | 
           183 | 
                   $lpg = $this->getDataGenerator()->get_plugin_generator('core_competency');
  | 
        
        
            | 
            | 
           184 | 
                   $framework = $lpg->create_framework();
  | 
        
        
            | 
            | 
           185 | 
                   $c1 = $lpg->create_competency(array('competencyframeworkid' => $framework->get('id')));
  | 
        
        
            | 
            | 
           186 | 
                   $c2 = $lpg->create_competency(array('competencyframeworkid' => $framework->get('id')));
  | 
        
        
            | 
            | 
           187 | 
                   $rc1 = $lpg->create_user_competency(array('userid' => $user->id, 'competencyid' => $c1->get('id')));
  | 
        
        
            | 
            | 
           188 | 
                   $rc2 = $lpg->create_user_competency(array('userid' => $user->id, 'competencyid' => $c2->get('id')));
  | 
        
        
            | 
            | 
           189 | 
                   $e = $lpg->create_evidence(array('usercompetencyid' => $rc1->get('id')));
  | 
        
        
            | 
            | 
           190 | 
                   $e = $lpg->create_evidence(array('usercompetencyid' => $rc2->get('id')));
  | 
        
        
            | 
            | 
           191 | 
                   $this->assertEquals(2, evidence::count_records());
  | 
        
        
            | 
            | 
           192 | 
                   $this->assertInstanceOf('\core_competency\evidence', $e);
  | 
        
        
            | 
            | 
           193 | 
               }
  | 
        
        
            | 
            | 
           194 | 
              | 
        
        
           | 11 | 
           efrain | 
           195 | 
               public function test_create_course_competency(): void {
  | 
        
        
           | 1 | 
           efrain | 
           196 | 
                   $this->resetAfterTest(true);
  | 
        
        
            | 
            | 
           197 | 
              | 
        
        
            | 
            | 
           198 | 
                   $lpg = $this->getDataGenerator()->get_plugin_generator('core_competency');
  | 
        
        
            | 
            | 
           199 | 
                   $course1 = $this->getDataGenerator()->create_course();
  | 
        
        
            | 
            | 
           200 | 
                   $course2 = $this->getDataGenerator()->create_course();
  | 
        
        
            | 
            | 
           201 | 
                   $framework = $lpg->create_framework();
  | 
        
        
            | 
            | 
           202 | 
                   $c1 = $lpg->create_competency(array('competencyframeworkid' => $framework->get('id')));
  | 
        
        
            | 
            | 
           203 | 
                   $c2 = $lpg->create_competency(array('competencyframeworkid' => $framework->get('id')));
  | 
        
        
            | 
            | 
           204 | 
                   $c3 = $lpg->create_competency(array('competencyframeworkid' => $framework->get('id')));
  | 
        
        
            | 
            | 
           205 | 
                   $this->assertEquals(0, course_competency::count_records());
  | 
        
        
            | 
            | 
           206 | 
                   $rc = $lpg->create_course_competency(array('competencyid' => $c1->get('id'), 'courseid' => $course1->id));
  | 
        
        
            | 
            | 
           207 | 
                   $rc = $lpg->create_course_competency(array('competencyid' => $c2->get('id'), 'courseid' => $course1->id));
  | 
        
        
            | 
            | 
           208 | 
                   $this->assertEquals(2, course_competency::count_records(array('courseid' => $course1->id)));
  | 
        
        
            | 
            | 
           209 | 
                   $this->assertEquals(0, course_competency::count_records(array('courseid' => $course2->id)));
  | 
        
        
            | 
            | 
           210 | 
                   $rc = $lpg->create_course_competency(array('competencyid' => $c3->get('id'), 'courseid' => $course2->id));
  | 
        
        
            | 
            | 
           211 | 
                   $this->assertEquals(1, course_competency::count_records(array('courseid' => $course2->id)));
  | 
        
        
            | 
            | 
           212 | 
                   $this->assertInstanceOf('\core_competency\course_competency', $rc);
  | 
        
        
            | 
            | 
           213 | 
               }
  | 
        
        
            | 
            | 
           214 | 
              | 
        
        
           | 11 | 
           efrain | 
           215 | 
               public function test_create_course_module_competency(): void {
  | 
        
        
           | 1 | 
           efrain | 
           216 | 
                   $this->resetAfterTest(true);
  | 
        
        
            | 
            | 
           217 | 
              | 
        
        
            | 
            | 
           218 | 
                   $lpg = $this->getDataGenerator()->get_plugin_generator('core_competency');
  | 
        
        
            | 
            | 
           219 | 
                   $course1 = $this->getDataGenerator()->create_course();
  | 
        
        
            | 
            | 
           220 | 
                   $cm1 = $this->getDataGenerator()->create_module('forum', array('course' => $course1->id));
  | 
        
        
            | 
            | 
           221 | 
                   $cm2 = $this->getDataGenerator()->create_module('forum', array('course' => $course1->id));
  | 
        
        
            | 
            | 
           222 | 
                   $framework = $lpg->create_framework();
  | 
        
        
            | 
            | 
           223 | 
                   $c1 = $lpg->create_competency(array('competencyframeworkid' => $framework->get('id')));
  | 
        
        
            | 
            | 
           224 | 
                   $c2 = $lpg->create_competency(array('competencyframeworkid' => $framework->get('id')));
  | 
        
        
            | 
            | 
           225 | 
                   $c3 = $lpg->create_competency(array('competencyframeworkid' => $framework->get('id')));
  | 
        
        
            | 
            | 
           226 | 
                   $this->assertEquals(0, course_module_competency::count_records());
  | 
        
        
            | 
            | 
           227 | 
                   $rc = $lpg->create_course_module_competency(array('competencyid' => $c1->get('id'), 'cmid' => $cm1->cmid));
  | 
        
        
            | 
            | 
           228 | 
                   $rc = $lpg->create_course_module_competency(array('competencyid' => $c2->get('id'), 'cmid' => $cm1->cmid));
  | 
        
        
            | 
            | 
           229 | 
                   $this->assertEquals(2, course_module_competency::count_records(array('cmid' => $cm1->cmid)));
  | 
        
        
            | 
            | 
           230 | 
                   $this->assertEquals(0, course_module_competency::count_records(array('cmid' => $cm2->cmid)));
  | 
        
        
            | 
            | 
           231 | 
                   $rc = $lpg->create_course_module_competency(array('competencyid' => $c3->get('id'), 'cmid' => $cm2->cmid));
  | 
        
        
            | 
            | 
           232 | 
                   $this->assertEquals(1, course_module_competency::count_records(array('cmid' => $cm2->cmid)));
  | 
        
        
            | 
            | 
           233 | 
                   $this->assertInstanceOf('\core_competency\course_module_competency', $rc);
  | 
        
        
            | 
            | 
           234 | 
               }
  | 
        
        
            | 
            | 
           235 | 
              | 
        
        
            | 
            | 
           236 | 
           }
  | 
        
        
            | 
            | 
           237 | 
              |