Skip to content

Commit

Permalink
MDL-57890 ws: Return cmid in all get_by_courses WebServices
Browse files Browse the repository at this point in the history
  • Loading branch information
dpalou committed Feb 7, 2017
1 parent f993134 commit 16840c7
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions mod/folder/classes/external.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ public static function get_folders_by_courses_returns() {
new external_single_structure(
array(
'id' => new external_value(PARAM_INT, 'Module id'),
'coursemodule' => new external_value(PARAM_INT, 'Course module id'),
'course' => new external_value(PARAM_INT, 'Course id'),
'name' => new external_value(PARAM_RAW, 'Page name'),
'intro' => new external_value(PARAM_RAW, 'Summary'),
Expand Down
5 changes: 3 additions & 2 deletions mod/folder/tests/externallib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,9 @@ public function test_mod_folder_get_folders_by_courses() {
$returndescription = mod_folder_external::get_folders_by_courses_returns();

// Create what we expect to be returned when querying the two courses.
$expectedfields = array('id', 'course', 'name', 'intro', 'introformat', 'introfiles', 'revision', 'timemodified',
'display', 'showexpanded', 'showdownloadfolder', 'section', 'visible', 'groupmode', 'groupingid');
$expectedfields = array('id', 'coursemodule', 'course', 'name', 'intro', 'introformat', 'introfiles', 'revision',
'timemodified', 'display', 'showexpanded', 'showdownloadfolder', 'section', 'visible',
'groupmode', 'groupingid');

// Add expected coursemodule and data.
$folder1->coursemodule = $folder1->cmid;
Expand Down
1 change: 1 addition & 0 deletions mod/label/classes/external.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public static function get_labels_by_courses_returns() {
new external_single_structure(
array(
'id' => new external_value(PARAM_INT, 'Module id'),
'coursemodule' => new external_value(PARAM_INT, 'Course module id'),
'course' => new external_value(PARAM_INT, 'Course id'),
'name' => new external_value(PARAM_RAW, 'Label name'),
'intro' => new external_value(PARAM_RAW, 'Label contents'),
Expand Down
4 changes: 2 additions & 2 deletions mod/label/tests/externallib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ public function test_mod_label_get_labels_by_courses() {
$returndescription = mod_label_external::get_labels_by_courses_returns();

// Create what we expect to be returned when querying the two courses.
$expectedfields = array('id', 'course', 'name', 'intro', 'introformat', 'introfiles', 'timemodified', 'section',
'visible', 'groupmode', 'groupingid');
$expectedfields = array('id', 'coursemodule', 'course', 'name', 'intro', 'introformat', 'introfiles', 'timemodified',
'section', 'visible', 'groupmode', 'groupingid');

// Add expected coursemodule and data.
$label1->coursemodule = $label1->cmid;
Expand Down
1 change: 1 addition & 0 deletions mod/page/classes/external.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ public static function get_pages_by_courses_returns() {
new external_single_structure(
array(
'id' => new external_value(PARAM_INT, 'Module id'),
'coursemodule' => new external_value(PARAM_INT, 'Course module id'),
'course' => new external_value(PARAM_INT, 'Course id'),
'name' => new external_value(PARAM_RAW, 'Page name'),
'intro' => new external_value(PARAM_RAW, 'Summary'),
Expand Down
2 changes: 1 addition & 1 deletion mod/page/tests/externallib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function test_mod_page_get_pages_by_courses() {
$returndescription = mod_page_external::get_pages_by_courses_returns();

// Create what we expect to be returned when querying the two courses.
$expectedfields = array('id', 'course', 'name', 'intro', 'introformat', 'introfiles',
$expectedfields = array('id', 'coursemodule', 'course', 'name', 'intro', 'introformat', 'introfiles',
'content', 'contentformat', 'contentfiles', 'legacyfiles', 'legacyfileslast', 'display',
'displayoptions', 'revision', 'timemodified', 'section', 'visible', 'groupmode', 'groupingid');

Expand Down
1 change: 1 addition & 0 deletions mod/resource/classes/external.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ public static function get_resources_by_courses_returns() {
new external_single_structure(
array(
'id' => new external_value(PARAM_INT, 'Module id'),
'coursemodule' => new external_value(PARAM_INT, 'Course module id'),
'course' => new external_value(PARAM_INT, 'Course id'),
'name' => new external_value(PARAM_RAW, 'Page name'),
'intro' => new external_value(PARAM_RAW, 'Summary'),
Expand Down
2 changes: 1 addition & 1 deletion mod/resource/tests/externallib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public function test_mod_resource_get_resources_by_courses() {
$returndescription = mod_resource_external::get_resources_by_courses_returns();

// Create what we expect to be returned when querying the two courses.
$expectedfields = array('id', 'course', 'name', 'intro', 'introformat', 'introfiles',
$expectedfields = array('id', 'coursemodule', 'course', 'name', 'intro', 'introformat', 'introfiles',
'contentfiles', 'tobemigrated', 'legacyfiles', 'legacyfileslast', 'display', 'displayoptions',
'filterfiles', 'revision', 'timemodified', 'section', 'visible', 'groupmode', 'groupingid');

Expand Down
1 change: 1 addition & 0 deletions mod/url/classes/external.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ public static function get_urls_by_courses_returns() {
new external_single_structure(
array(
'id' => new external_value(PARAM_INT, 'Module id'),
'coursemodule' => new external_value(PARAM_INT, 'Course module id'),
'course' => new external_value(PARAM_INT, 'Course id'),
'name' => new external_value(PARAM_RAW, 'URL name'),
'intro' => new external_value(PARAM_RAW, 'Summary'),
Expand Down
5 changes: 3 additions & 2 deletions mod/url/tests/externallib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,9 @@ public function test_mod_url_get_urls_by_courses() {
$returndescription = mod_url_external::get_urls_by_courses_returns();

// Create what we expect to be returned when querying the two courses.
$expectedfields = array('id', 'course', 'name', 'intro', 'introformat', 'introfiles', 'externalurl', 'display',
'displayoptions', 'parameters', 'timemodified', 'section', 'visible', 'groupmode', 'groupingid');
$expectedfields = array('id', 'coursemodule', 'course', 'name', 'intro', 'introformat', 'introfiles', 'externalurl',
'display', 'displayoptions', 'parameters', 'timemodified', 'section', 'visible', 'groupmode',
'groupingid');

// Add expected coursemodule and data.
$url1->coursemodule = $url1->cmid;
Expand Down

0 comments on commit 16840c7

Please sign in to comment.