Dear All,
I develop some external API functions for Moodle in the <Moodle>/local/COMPONENTFOLDER.
I create a test folder as guided at https://docs.moodle.org/dev/Web_Services_Unit_Test. I try to follow this instruction but I don,t understand how to make use the following code:
$contextid = context_XXXX::instance()->id;
$roleid = $this->assignUserCapability('moodle/CAPABILITYNAME', $contextid);
$params = array(PARAM1, PARAM2, ...);
$returnvalue = COMPONENT_external::FUNCTION_NAME($params);
as shown in the above instruction.
I wonder how to create the class context_XXXX.
Please share me some comprehensive examples to help me overcome this issue.
Many thanks