Skip to content

Commit

Permalink
MDL-69319 mod_lti: remove unused vars from externallib_test
Browse files Browse the repository at this point in the history
  • Loading branch information
snake committed Jul 22, 2020
1 parent 654c27e commit b77d023
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions mod/lti/tests/externallib_test.php
Expand Up @@ -92,7 +92,7 @@ protected function setup_test_data() {
* Test view_lti
*/
public function test_get_tool_launch_data() {
global $USER, $SITE;
global $USER;

$td = $this->setup_test_data();
$lti = $td['lti'];
Expand Down Expand Up @@ -127,8 +127,6 @@ public function test_get_tool_launch_data() {
* Test get ltis by courses
*/
public function test_mod_lti_get_ltis_by_courses() {
global $DB;

$td = $this->setup_test_data();
$course = $td['course'];
$lti = $td['lti'];
Expand Down Expand Up @@ -259,8 +257,6 @@ public function test_mod_lti_get_ltis_by_courses() {
* Test view_lti
*/
public function test_view_lti() {
global $DB;

$td = $this->setup_test_data();
$lti = $td['lti'];
$context = $td['context'];
Expand Down Expand Up @@ -292,7 +288,8 @@ public function test_view_lti() {
$sink = $this->redirectEvents();

$result = mod_lti_external::view_lti($lti->id);
$result = external_api::clean_returnvalue(mod_lti_external::view_lti_returns(), $result);
// The value of the result isn't needed but validation is.
external_api::clean_returnvalue(mod_lti_external::view_lti_returns(), $result);

$events = $sink->get_events();
$this->assertCount(1, $events);
Expand Down Expand Up @@ -343,8 +340,8 @@ public function test_mod_lti_create_tool_proxy() {
public function test_mod_lti_create_tool_proxy_duplicateurl() {
$this->setAdminUser();
$this->expectException('moodle_exception');
$proxy = mod_lti_external::create_tool_proxy('Test proxy 1', $this->getExternalTestFileUrl('/test.html'), array(), array());
$proxy = mod_lti_external::create_tool_proxy('Test proxy 2', $this->getExternalTestFileUrl('/test.html'), array(), array());
mod_lti_external::create_tool_proxy('Test proxy 1', $this->getExternalTestFileUrl('/test.html'), array(), array());
mod_lti_external::create_tool_proxy('Test proxy 2', $this->getExternalTestFileUrl('/test.html'), array(), array());
}

/*
Expand All @@ -355,7 +352,7 @@ public function test_mod_lti_create_tool_proxy_without_capability() {
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'editingteacher');
$this->setUser($teacher);
$this->expectException('required_capability_exception');
$proxy = mod_lti_external::create_tool_proxy('Test proxy', $this->getExternalTestFileUrl('/test.html'), array(), array());
mod_lti_external::create_tool_proxy('Test proxy', $this->getExternalTestFileUrl('/test.html'), array(), array());
}

/*
Expand Down Expand Up @@ -409,7 +406,7 @@ public function test_mod_lti_get_tool_types() {
$type->description = "Example description";
$type->toolproxyid = $proxy->id;
$type->baseurl = $this->getExternalTestFileUrl('/test.html');
$typeid = lti_add_type($type, $data);
lti_add_type($type, $data);

$types = mod_lti_external::get_tool_types($proxy->id);
$types = external_api::clean_returnvalue(mod_lti_external::get_tool_types_returns(), $types);
Expand Down Expand Up @@ -445,15 +442,15 @@ public function test_mod_lti_create_tool_type() {
*/
public function test_mod_lti_create_tool_type_nonexistant_file() {
$this->expectException('moodle_exception');
$type = mod_lti_external::create_tool_type($this->getExternalTestFileUrl('/doesntexist.xml'), '', '');
mod_lti_external::create_tool_type($this->getExternalTestFileUrl('/doesntexist.xml'), '', '');
}

/*
* Test create tool type failure from xml that is not a cartridge
*/
public function test_mod_lti_create_tool_type_bad_file() {
$this->expectException('moodle_exception');
$type = mod_lti_external::create_tool_type($this->getExternalTestFileUrl('/rsstest.xml'), '', '');
mod_lti_external::create_tool_type($this->getExternalTestFileUrl('/rsstest.xml'), '', '');
}

/*
Expand All @@ -464,7 +461,7 @@ public function test_mod_lti_create_tool_type_without_capability() {
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'editingteacher');
$this->setUser($teacher);
$this->expectException('required_capability_exception');
$type = mod_lti_external::create_tool_type($this->getExternalTestFileUrl('/ims_cartridge_basic_lti_link.xml'), '', '');
mod_lti_external::create_tool_type($this->getExternalTestFileUrl('/ims_cartridge_basic_lti_link.xml'), '', '');
}

/*
Expand Down Expand Up @@ -509,7 +506,7 @@ public function test_mod_lti_delete_tool_type_without_capability() {
$course = $this->getDataGenerator()->create_course();
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'editingteacher');
$this->setUser($teacher);
$type = mod_lti_external::delete_tool_type($type['id']);
mod_lti_external::delete_tool_type($type['id']);
}

/*
Expand Down

0 comments on commit b77d023

Please sign in to comment.