1/ test autoloading when executing external function from PHP
vendor/bin/phpunit --colors core_grading_externallib_testcase
|
2/ test the core_grading_get_definitions and core_grading_get_gradingform_instances web service functions work:
In order to test the webservices:
Use this client: https://gist.github.com/jleyva/9551523
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 (Plugins / WebServices), add a shortname to that service (in the databasem there is not ui), and add the webservices to be tested to that service
To get a token:
yourmoodle.com/login/token.php?service=ServiceShortname&username=XX&password=YYY
You should get the token using a teacher account or someone to privileges for the module you are going to check
1 Create a new course
2 Add a new "Assignment"
3 In the edit block of the assignment, go to advanced grading and create some rubrics
4 Edit the client for adding your token, moodle url and parameters (cmid for the first web service)
5 Run the script, if everything is ok you will get a list of definitions
Now, as a student you should submit something and as a teacher grade it using the rubrics
6 Edit the script again, uncomment the last block of code, and for the second webservice as a parameter one of the "ids" of the definitions you get in the previous step
7 Run the script again the second webservice should return information