/** * Test getting the cartridge url of a tool. */ public function test_get_cartridge_url() { global $CFG; $slasharguments = $CFG->slasharguments; $CFG->slasharguments = false; $course1 = $this->getDataGenerator()->create_course(); $data = new stdClass(); $data->courseid = $course1->id; $tool1 = $this->create_tool($data); $id = $tool1->id; $token = \enrol_lti\helper::generate_tool_token($id); $launchurl = \enrol_lti\helper::get_cartridge_url($tool1); $this->assertEquals('http://www.example.com/moodle/enrol/lti/cartridge.php?id=' . $id . '&token=' . $token, $launchurl->out()); $CFG->slasharguments = true; $launchurl = \enrol_lti\helper::get_cartridge_url($tool1); $this->assertEquals('http://www.example.com/moodle/enrol/lti/cartridge.php/' . $id . '/' . $token . '/cartridge.xml', $launchurl->out()); $CFG->slasharguments = $slasharguments; }