Details

    • Testing Instructions:
      Hide

      run phpunit core_grades_external_testcase lib/tests/grades_externallib_test.php

      Testing:

      Enable Web Services in Advanced features
      Enable Web services for mobile devices in Plugins / WebServices / Services

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

      You need a token related to a service, for get a token you need to create a new service, add a shortname to that service, and add the core_grade_get_grades function to that service

      Create Token:

      1. Click on Site administration ► Plugins ► Web services ► Manage tokens
      2. Click add, select user and service (You should get two tokens, one for student and one for teacher account)

      1 Create a new course, enrol the student and user used before
      2 As teacher, create a new assign (require a only text submission) as a the same student you used for getting the token, submit a text.
      3 Grade the submission as the teacher
      4 Edit the client.php for adding your custom tokens and Moodle URL, also the parameters required (courseid, userids with the student user id, and cmid for the assign module)
      5 Open the script in a browser
      6 The script gets the current grade, then update the grade (using the update_grade) function to a random (0, 100) them, retrieve again the grade to check if it were successfully updated
      7 You can change the userid to a different id that the current user to test if you got permission errors, you should change alto the activityid to an existing activity, you should get errors also

      Show
      run phpunit core_grades_external_testcase lib/tests/grades_externallib_test.php Testing: Enable Web Services in Advanced features Enable Web services for mobile devices in Plugins / WebServices / Services Use this client: https://gist.github.com/jleyva/9687810 The curl.php file is here: https://github.com/moodlehq/sample-ws-clients/blob/master/PHP-REST/curl.php You need a token related to a service, for get a token you need to create a new service, add a shortname to that service, and add the core_grade_get_grades function to that service Create Token: Click on Site administration ► Plugins ► Web services ► Manage tokens Click add, select user and service (You should get two tokens, one for student and one for teacher account) 1 Create a new course, enrol the student and user used before 2 As teacher, create a new assign (require a only text submission) as a the same student you used for getting the token, submit a text. 3 Grade the submission as the teacher 4 Edit the client.php for adding your custom tokens and Moodle URL, also the parameters required (courseid, userids with the student user id, and cmid for the assign module) 5 Open the script in a browser 6 The script gets the current grade, then update the grade (using the update_grade) function to a random (0, 100) them, retrieve again the grade to check if it were successfully updated 7 You can change the userid to a different id that the current user to test if you got permission errors, you should change alto the activityid to an existing activity, you should get errors also
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-30085_grade_ws

      Gliffy Diagrams

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                7 Vote for this issue
                Watchers:
                18 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  12/May/14