File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -1231,7 +1231,7 @@ public static function list_course_module_competencies($cmorid) {
12311231 $ result = array ();
12321232
12331233 // TODO We could improve the performance of this into one single query.
1234- $ coursemodulecompetencies = course_competency ::list_course_module_competencies ($ cm ->id );
1234+ $ coursemodulecompetencies = course_module_competency ::list_course_module_competencies ($ cm ->id );
12351235 $ competencies = course_module_competency::list_competencies ($ cm ->id );
12361236
12371237 // Build the return values.
Original file line number Diff line number Diff line change @@ -2757,6 +2757,16 @@ public function test_list_course_modules_using_competency() {
27572757 $ result = api::list_course_module_competencies_in_course_module ($ cm ->id );
27582758 $ this ->assertEquals ($ result [0 ]->get ('competencyid ' ), $ c ->get ('id ' ));
27592759 $ this ->assertEquals ($ result [1 ]->get ('competencyid ' ), $ c2 ->get ('id ' ));
2760+
2761+ // Now get the course competency and coursemodule competency together.
2762+ $ result = api::list_course_module_competencies ($ cm ->id );
2763+ // Now we should have an array and each element of the array should have a competency and
2764+ // a coursemodulecompetency.
2765+ foreach ($ result as $ instance ) {
2766+ $ cmc = $ instance ['coursemodulecompetency ' ];
2767+ $ c = $ instance ['competency ' ];
2768+ $ this ->assertEquals ($ cmc ->get ('competencyid ' ), $ c ->get ('id ' ));
2769+ }
27602770 }
27612771
27622772 /**
You can’t perform that action at this time.
0 commit comments