Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-29934 Web service API Roadmap
  3. MDL-30106

mod_forum_get_forum_discussion_posts()

XMLWordPrintable

    • MOODLE_22_STABLE, MOODLE_26_STABLE
    • MOODLE_27_STABLE
    • Hide

      Testing:

      Notice that I've bumped the version numbers in version.php and mod/forum/version.php so the new WebService is installed and also the Mobile service is updated with the new function.
      I'm not sure if the new function is installed before is added to the service. For the tester, maybe is better if you first upgrade the mod/forum and then bump the moodle/version.php number

      Use this client: https://gist.github.com/jleyva/9347596
      The curl.php file is here: https://github.com/moodlehq/sample-ws-clients/blob/master/PHP-REST/curl.php

      You need a token for the Mobile Service:
      Create Token:
      Click on Site administration ► Plugins ► Web services ► Manage tokens
      Click add, select user and service (Mobile Service)

      1 Create a new course
      2 Create a new forum with a discussion and some posts
      3 Edit the client.php for adding your custom token and Moodle URL, also the discussion id
      Remember to enrol the user you used to get a token to the course
      4 Open the script in a browser
      5 Check that you receive all the posts in the discussions
      6 Check that the user fullname is displayed correctly
      7 Make not visible the forum, run the script again. You should get the error

      {"exception":"moodle_exception","errorcode":"nopermissiontoshow","message":"No permission to see this!"}

      7 Change the discussion id for an inexistent one, run the script, you should get an error also dml_missing_record_exception
      8 Create a new token for a different user not enrolled in the course, run the script again, you should get an error: require_login_exception
      9 Change the values "sortby" and "sortdirection" in the script with invalid values like userid or DESCCC , run the script, you should get an error about invalid parameters
      10 Change the values sortby and sortdirection for correct values like "id, modified, created" and "ASC" , "DESC" and check that the post are retrieved in the correct order and direction
      11 You may test algo groups: create two separate groups, post in the forums with users in different groups. Then try to get the messages from a discussion started by a user in a different group that the current user you are testing with, you must get no permissions erros
      12 Do the same but using visible groups, the user should be able to get all the messages

      Show
      Testing: Notice that I've bumped the version numbers in version.php and mod/forum/version.php so the new WebService is installed and also the Mobile service is updated with the new function. I'm not sure if the new function is installed before is added to the service. For the tester, maybe is better if you first upgrade the mod/forum and then bump the moodle/version.php number Use this client: https://gist.github.com/jleyva/9347596 The curl.php file is here: https://github.com/moodlehq/sample-ws-clients/blob/master/PHP-REST/curl.php You need a token for the Mobile Service: Create Token: Click on Site administration ► Plugins ► Web services ► Manage tokens Click add, select user and service (Mobile Service) 1 Create a new course 2 Create a new forum with a discussion and some posts 3 Edit the client.php for adding your custom token and Moodle URL, also the discussion id Remember to enrol the user you used to get a token to the course 4 Open the script in a browser 5 Check that you receive all the posts in the discussions 6 Check that the user fullname is displayed correctly 7 Make not visible the forum, run the script again. You should get the error {"exception":"moodle_exception","errorcode":"nopermissiontoshow","message":"No permission to see this!"} 7 Change the discussion id for an inexistent one, run the script, you should get an error also dml_missing_record_exception 8 Create a new token for a different user not enrolled in the course, run the script again, you should get an error: require_login_exception 9 Change the values "sortby" and "sortdirection" in the script with invalid values like userid or DESCCC , run the script, you should get an error about invalid parameters 10 Change the values sortby and sortdirection for correct values like "id, modified, created" and "ASC" , "DESC" and check that the post are retrieved in the correct order and direction 11 You may test algo groups: create two separate groups, post in the forums with users in different groups. Then try to get the messages from a discussion started by a user in a different group that the current user you are testing with, you must get no permissions erros 12 Do the same but using visible groups, the user should be able to get all the messages

          jleyva Juan Leyva
          jerome Jérôme Mouneyrac
          Damyon Wiese Damyon Wiese
          Dan Poltawski Dan Poltawski
          Rajesh Taneja Rajesh Taneja
          Votes:
          1 Vote for this issue
          Watchers:
          8 Start watching this issue

            Created:
            Updated:
            Resolved:

              Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.