Skip to content

Commit

Permalink
MDL-52821 lti: Include tool_consumer_instance_description in launch
Browse files Browse the repository at this point in the history
  • Loading branch information
John Okely committed Mar 4, 2016
1 parent 7adc7ef commit 7204d77
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions mod/lti/locallib.php
Expand Up @@ -54,6 +54,7 @@
use moodle\mod\lti as lti;

require_once($CFG->dirroot.'/mod/lti/OAuth.php');
require_once($CFG->libdir.'/weblib.php');

define('LTI_URL_DOMAIN_REGEX', '/(?:https?:\/\/)?(?:www\.)?([^\/]+)(?:\/|$)/i');

Expand Down Expand Up @@ -503,6 +504,7 @@ function lti_build_standard_request($instance, $orgid, $islti2) {
} else {
$requestparams['tool_consumer_instance_name'] = get_site()->fullname;
}
$requestparams['tool_consumer_instance_description'] = html_to_text(get_site()->summary, 0);

return $requestparams;
}
Expand Down
8 changes: 6 additions & 2 deletions mod/lti/tests/externallib_test.php
Expand Up @@ -71,14 +71,16 @@ public function setUp() {
* Test view_lti
*/
public function test_get_tool_launch_data() {
global $USER;
global $USER, $SITE;

$SITE->summary = "This is a <b>long</b> front page summary with html, it should exceed more than seventy-five characters.";

$result = mod_lti_external::get_tool_launch_data($this->lti->id);
$result = external_api::clean_returnvalue(mod_lti_external::get_tool_launch_data_returns(), $result);

// Basic test, the function returns what it's expected.
self::assertEquals($this->lti->toolurl, $result['endpoint']);
self::assertCount(35, $result['parameters']);
self::assertCount(36, $result['parameters']);

// Check some parameters.
$parameters = array();
Expand All @@ -93,6 +95,8 @@ public function test_get_tool_launch_data() {
self::assertEquals($USER->lastname, $parameters['lis_person_name_family']);
self::assertEquals(fullname($USER), $parameters['lis_person_name_full']);
self::assertEquals($USER->username, $parameters['ext_user_username']);
self::assertEquals("This is a LONG front page summary with html, it should exceed more than seventy-five characters.",
$parameters['tool_consumer_instance_description']);

}

Expand Down

0 comments on commit 7204d77

Please sign in to comment.