diff --git a/tests/library_import_test.php b/tests/library_import_test.php index 44b4b50a4bfe0a4fc53b0f00d7db2a7652433034..a5f36ae8a3a7f2b084e127d240eab25adcf5114f 100644 --- a/tests/library_import_test.php +++ b/tests/library_import_test.php @@ -105,13 +105,13 @@ final class library_import_test extends externallib_advanced_testcase { } /** - * Test the library_import function fails when no webservice export capability assigned. + * Test the library_import function fails when no capability to add questions assigned. */ - public function test_no_webservice_access(): void { + public function test_no_access(): void { global $DB; $context = context_course::instance($this->course->id); - $studentroleid = $DB->get_field('role', 'id', ['shortname' => 'student']); - role_assign($studentroleid, $this->user->id, $context->id); + $teacherroleid = $DB->get_field('role', 'id', ['shortname' => 'teacher']); + role_assign($teacherroleid, $this->user->id, $context->id); $this->getDataGenerator()->enrol_user($this->user->id, $this->course->id); $this->expectException(required_capability_exception::class); $this->expectExceptionMessage('you do not currently have permissions to do that (Add new questions).'); diff --git a/tests/library_render_test.php b/tests/library_render_test.php index e0f550ea02b8c88c501655864a6a1c1d15116f24..98383e4c35eb2773072852626fc036150dcf721e 100644 --- a/tests/library_render_test.php +++ b/tests/library_render_test.php @@ -108,13 +108,13 @@ final class library_render_test extends externallib_advanced_testcase { } /** - * Test the library_render function fails when no webservice export capability assigned. + * Test the library_render function fails when no capability assigned. */ public function test_no_webservice_access(): void { global $DB; $context = context_course::instance($this->course->id); - $studentroleid = $DB->get_field('role', 'id', ['shortname' => 'student']); - role_assign($studentroleid, $this->user->id, $context->id); + $teacherroleid = $DB->get_field('role', 'id', ['shortname' => 'teacher']); + role_assign($teacherroleid, $this->user->id, $context->id); $this->getDataGenerator()->enrol_user($this->user->id, $this->course->id); $this->expectException(required_capability_exception::class); $this->expectExceptionMessage('you do not currently have permissions to do that (Add new questions).');