Skip to content

Commit

Permalink
PM-45329 lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jvs-kialo committed May 30, 2024
1 parent 18877ad commit 6979414
Show file tree
Hide file tree
Showing 12 changed files with 79 additions and 84 deletions.
73 changes: 34 additions & 39 deletions lang/en/kialo.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,69 +32,64 @@

defined('MOODLE_INTERNAL') || die();

$string['modulename'] = 'Kialo Discussion';
$string['modulenameplural'] = 'Kialo Discussions';
$string['pluginname'] = 'Kialo Discussion';
$string['cachedef_nonces'] = "Used to store temporary nonces to secure LTI requests.";
$string['deploymentid'] = "Discussion Linked";
$string['discussion_title'] = 'Discussion';
$string['hello'] = 'Hello World!';
$string['pluginadministration'] = 'Edit Kialo Discussion';
$string['kialo:addinstance'] = 'Add a new Kialo Discussion';
$string['kialo:kialo_admin'] = 'Granted Admin rights in Kialo discussions';
$string['kialo:view'] = 'View Kialo discussions';
$string['kialofieldset'] = 'Kialo Fieldset';
$string['kialoname'] = 'Activity Name';
$string['kialosettings'] = 'Settings';
$string['kialofieldset'] = 'Kialo Fieldset';
$string['select_discussion'] = 'Select Discussion';
$string['modulename'] = 'Kialo Discussion';
$string['modulenameplural'] = 'Kialo Discussions';
$string['pluginadministration'] = 'Edit Kialo Discussion';
$string['pluginname'] = 'Kialo Discussion';
$string['select_discussion_help'] =
'Opens Kialo in a new tab to select a discussion for this activity. You can create a Kialo account during this process if you don’t already have one.';
$string['discussion_title'] = 'Discussion';
$string['deploymentid'] = "Discussion Linked";
$string['cachedef_nonces'] = "Used to store temporary nonces to secure LTI requests.";
$string['kialo:addinstance'] = 'Add a new Kialo Discussion';
$string['kialo:view'] = 'View Kialo discussions';
$string['kialo:kialo_admin'] = 'Granted Admin rights in Kialo discussions';
$string['select_discussion'] = 'Select Discussion';

// Help texts.
$string['modulename_help'] = 'The Kialo Discussion activity allows you to include a Kialo discussion in your Moodle course. Students can participate in the discussion directly from Moodle, without having to manually create Kialo accounts. Kialo discussions are a great way to teach and train critical thinking, argumentation and to facilitate thoughtful classroom discussions.';
$string['modulename_link'] = 'https://support.kialo-edu.com/en/hc/moodle';

// Displayed while redirecting to Kialo during the LTI flows.
$string['redirect_title'] = "Loading";
$string['redirect_loading'] = "Loading";
$string['close_prompt'] = 'You can close this window now.';
$string['redirect_loading'] = "Loading";
$string['redirect_title'] = "Loading";

// Errors.
$string['errors:nopermissiontoview'] = "You do not have permission to view this activity.";
$string['errors:ltiauth'] = "Authentication failed due to an unexpected error. Please try again.";
$string['errors:resourcelink'] = "Activity cannot be displayed due to an unexpected error. Please try again.";
$string['errors:deeplinking'] = "Something went wrong with the discussion selection. Please try again.";
$string['errors:noguestaccess'] = "Guests cannot access this activity. Please log in.";
$string['errors:invalidrequest'] = "Invalid request";
$string['errors:missingdeploymentid'] = "Missing deployment id";
$string['errors:ltiauth'] = "Authentication failed due to an unexpected error. Please try again.";
$string['errors:missingcourseid'] = "Missing course id";
$string['errors:missingdeploymentid'] = "Missing deployment id";
$string['errors:missingidtoken'] = "Missing id token";
$string['errors:missingsessiondata'] = "Missing session data";
$string['errors:noguestaccess'] = "Guests cannot access this activity. Please log in.";
$string['errors:nopermissiontoview'] = "You do not have permission to view this activity.";
$string['errors:resourcelink'] = "Activity cannot be displayed due to an unexpected error. Please try again.";

// Privacy API.
$string['privacy:metadata:kialo'] =
'User data needs to be exchanged with Kialo Edu in order to automatically create accounts for Moodle users on kialo-edu.com, and to make the user experience as seamless as possible.';

$string['privacy:metadata:kialo:userid'] = 'The userid is sent from Moodle to allow you to access your data on Kialo Edu.';
$string['privacy:metadata:kialo:courseid'] = 'The ID of the user’s course.';
$string['privacy:metadata:kialo:email'] = 'The email address is sent from Moodle to allow you to access your data on Kialo Edu.';
$string['privacy:metadata:kialo:username'] = 'The user name is sent from Moodle to set the default user name on Kialo Edu.';
$string['privacy:metadata:kialo:fullname'] = 'Your full name is sent to Kialo Edu to allow a better user experience.';
$string['privacy:metadata:kialo:language'] =
'Your language preference is sent to Kialo Edu to automatically set the user interface language.';
$string['privacy:metadata:kialo:timezone'] =
'Your time zone preference is sent to Kialo Edu to automatically set the user time zone.';
$string['privacy:metadata:kialo:language'] = 'Your language preference is sent to Kialo Edu to automatically set the user interface language.';
$string['privacy:metadata:kialo:nullproviderreason'] = 'No user data is stored by our plugin in the Moodle database. Any data we use is stored externally on kialo-edu.com.';
$string['privacy:metadata:kialo:picture'] = 'Your account avatar picture is sent to Kialo Edu to allow a better user experience.';
$string['privacy:metadata:kialo:role'] =
'The user’s role in the course is used to determine the correct permissions in the Kialo discussion.';
$string['privacy:metadata:kialo:courseid'] = 'The ID of the user’s course.';
$string['privacy:metadata:kialo:nullproviderreason'] =
'No user data is stored by our plugin in the Moodle database. Any data we use is stored externally on kialo-edu.com.';
$string['privacy:metadata:kialo:role'] = 'The user’s role in the course is used to determine the correct permissions in the Kialo discussion.';
$string['privacy:metadata:kialo:timezone'] = 'Your time zone preference is sent to Kialo Edu to automatically set the user time zone.';
$string['privacy:metadata:kialo:userid'] = 'The userid is sent from Moodle to allow you to access your data on Kialo Edu.';
$string['privacy:metadata:kialo:username'] = 'The user name is sent from Moodle to set the default user name on Kialo Edu.';
$string['privacy:metadata:kialo'] =
'User data needs to be exchanged with Kialo Edu in order to automatically create accounts for Moodle users on kialo-edu.com, and to make the user experience as seamless as possible.';

// Settings.
$string["acceptterms"] = "Accept Terms of Service";
$string["acceptterms_desc"] =
'To enable the Kialo plugin you have to accept Kialo Edu’s <a href="{$a->terms}" target="_blank">Terms of Service</a> on behalf of all users of this Moodle instance. Here is a link to our <a href="{$a->privacy}" target="_blank">Privacy Policy</a> and to our <a href="{$a->data_security}" target="_blank">Data Security and Privacy Plan.</a>';
$string["termsnotaccepted"] =
'You have to accept Kialo’s <a href="{$a->terms}" target="_blank">Terms of Service</a> before you can enable the Kialo plugin.';
$string['groupmode_on_warning'] = '<b>Moodle groups are currently <u>not</u> automatically supported.</b> If you use the Kialo Moodle Plugin with a course that has multiple groups, <b>all</b> groups will find themselves in the <b>same</b> Kialo discussion.<br/><br/>To manually set up Kialo discussions for each of your groups, please follow the instructions in our <a href="{$a->grouphelpcenterlink}">help center</a>.<br/><br/>We will release automatic Moodle groups support in Q1 2024. <a href="{$a->pluginreleaseemailnotificationlink}">Submit your email address</a> to be notified when it is released.';
$string['groupmode_off_info'] = '<b>Please note that Moodle groups are currently <u>not</u> automatically supported.</b> (<a href="{$a->grouphelpcenterlink}">More info</a>)';
$string['groupmode_on_warning'] =
'<b>Moodle groups are currently <u>not</u> automatically supported.</b> If you use the Kialo Moodle Plugin with a course that has multiple groups, <b>all</b> groups will find themselves in the <b>same</b> Kialo discussion.<br/><br/>To manually set up Kialo discussions for each of your groups, please follow the instructions in our <a href="{$a->grouphelpcenterlink}">help center</a>.<br/><br/>We will release automatic Moodle groups support in Q1 2024. <a href="{$a->pluginreleaseemailnotificationlink}">Submit your email address</a> to be notified when it is released.';
$string["acceptterms_desc"] =
'To enable the Kialo plugin you have to accept Kialo Edu’s <a href="{$a->terms}" target="_blank">Terms of Service</a> on behalf of all users of this Moodle instance. Here is a link to our <a href="{$a->privacy}" target="_blank">Privacy Policy</a> and to our <a href="{$a->data_security}" target="_blank">Data Security and Privacy Plan.</a>';
$string["acceptterms"] = "Accept Terms of Service";
$string["termsnotaccepted"] = 'You have to accept Kialo’s <a href="{$a->terms}" target="_blank">Terms of Service</a> before you can enable the Kialo plugin.';
4 changes: 2 additions & 2 deletions tests/backup/backup_and_restore_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* @covers \mod_kialo\backup\backup_kialo_activity_task
* @covers \mod_kialo\backup\restore_kialo_activity_task
*/
class backup_and_restore_test extends advanced_testcase {
final class backup_and_restore_test extends advanced_testcase {

/**
* Setup to ensure that fixtures are loaded.
Expand All @@ -57,7 +57,7 @@ public static function setupbeforeclass(): void {
/**
* Test on Kialo activity backup and restore.
*/
public function test_backup_restore() {
public function test_backup_restore(): void {
global $DB;
$this->resetAfterTest();
$this->setAdminUser();
Expand Down
16 changes: 8 additions & 8 deletions tests/classes/kialo_config_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
/**
* Tests the mod_kialo config.
*/
class kialo_config_test extends \advanced_testcase {
final class kialo_config_test extends \advanced_testcase {
/**
* Tests the default tool URL.
* @covers \mod_kialo\kialo_config::get_instance::get_tool_url
*/
public function test_default_tool_url() {
public function test_default_tool_url(): void {
// The variable TARGET_KIALO_URL is only set in Kialo test environments. By default it's not defined.
putenv("TARGET_KIALO_URL=");

Expand All @@ -49,7 +49,7 @@ public function test_default_tool_url() {
* Tests that the tool URL can be overridden.
* @covers \mod_kialo\kialo_config::get_instance::get_tool_url
*/
public function test_custom_tool_url() {
public function test_custom_tool_url(): void {
putenv("TARGET_KIALO_URL=http://localhost:5000");
$this->assertEquals("http://localhost:5000", kialo_config::get_instance()->get_tool_url());
}
Expand All @@ -58,7 +58,7 @@ public function test_custom_tool_url() {
* Tests private key generation.
* @covers \mod_kialo\kialo_config::get_instance::get_platform_keychain
*/
public function test_private_key_generation() {
public function test_private_key_generation(): void {
// A key should have already been generated during installation by mod_kialo_verify_private_key() in upgradelib.php.
$keychain = kialo_config::get_instance()->get_platform_keychain();
$this->assertNotNull($keychain);
Expand All @@ -72,7 +72,7 @@ public function test_private_key_generation() {
* Tests client id generation.
* @covers \mod_kialo\kialo_config::get_instance::get_client_id
*/
public function test_client_id() {
public function test_client_id(): void {
// A clientid should have been generated during installation by mod_kialo_generate_client_id() in upgradelib.php.
$this->assertNotEmpty(kialo_config::get_instance()->get_client_id());
}
Expand All @@ -81,7 +81,7 @@ public function test_client_id() {
* Tests the platform configuration.
* @covers \mod_kialo\kialo_config::get_instance::get_platform
*/
public function test_get_platform() {
public function test_get_platform(): void {
$platform = kialo_config::get_instance()->get_platform();

$this->assertEquals("https://www.example.com/moodle/mod/kialo", $platform->getAudience());
Expand All @@ -94,7 +94,7 @@ public function test_get_platform() {
* Tests the tool configuration.
* @covers \mod_kialo\kialo_config::get_instance::get_tool
*/
public function test_get_tool() {
public function test_get_tool(): void {
putenv("TARGET_KIALO_URL=");
$tool = kialo_config::get_instance()->get_tool();

Expand All @@ -110,7 +110,7 @@ public function test_get_tool() {
* Tests the registration creation.
* @covers \mod_kialo\kialo_config::get_instance::create_registration
*/
public function test_registration() {
public function test_registration(): void {
$registration = kialo_config::get_instance()->create_registration("DEPLID1234");
$this->assertNotNull($registration);

Expand Down
14 changes: 7 additions & 7 deletions tests/classes/lti_flow_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
/**
* Tests the LTI flow.
*/
class lti_flow_test extends \advanced_testcase {
final class lti_flow_test extends \advanced_testcase {

/**
* Message is signed by the platform (the Kialo Moodle plugin).
Expand Down Expand Up @@ -315,7 +315,7 @@ public static function provide_lti_role_assertions(): array {
* @covers \mod_kialo\lti_flow::assign_lti_roles
* @dataProvider provide_lti_role_assertions
*/
public function test_assign_lti_roles(array $moodleroles, array $expectedltiroles) {
public function test_assign_lti_roles(array $moodleroles, array $expectedltiroles): void {
$this->resetAfterTest(true);

foreach ($moodleroles as $moodlerole) {
Expand All @@ -332,7 +332,7 @@ public function test_assign_lti_roles(array $moodleroles, array $expectedltirole
*
* @covers \mod_kialo\lti_flow::init_resource_link
*/
public function test_init_resource_link() {
public function test_init_resource_link(): void {
$this->getDataGenerator()->enrol_user($this->user->id, $this->course->id, "teacher");

// Construct the initial LTI message sent to Kialo when the user clicks on the activity.
Expand Down Expand Up @@ -533,7 +533,7 @@ function (Builder $builder) {
* @dataProvider provide_invalid_lti_auth_builders
* @covers \mod_kialo\lti_flow::validate_deep_linking_response
*/
public function test_invalid_lti_auth($signer, ?callable $builder, $exception) {
public function test_invalid_lti_auth($signer, ?callable $builder, $exception): void {
// The current user must be at least a student in the course. But this LTI step works the same for students and teachers.
$this->getDataGenerator()->enrol_user($this->user->id, $this->course->id, "student");

Expand All @@ -555,7 +555,7 @@ public function test_invalid_lti_auth($signer, ?callable $builder, $exception) {
*
* @covers \mod_kialo\lti_flow::init_deep_link
*/
public function test_init_deep_link() {
public function test_init_deep_link(): void {
$this->getDataGenerator()->enrol_user($this->user->id, $this->course->id, "teacher");

$deploymentid = "random-string-123";
Expand Down Expand Up @@ -643,7 +643,7 @@ private function prepare_deep_link_response_request($signer, ?callable $callable
* @return void
* @covers \mod_kialo\lti_flow::validate_deep_linking_response
*/
public function test_validate_deep_link_response() {
public function test_validate_deep_link_response(): void {
// Given a redirect GET request from Kialo with the deep linking response.
$this->prepare_deep_link_response_request(self::SIGNER_TOOL);

Expand Down Expand Up @@ -746,7 +746,7 @@ function (Builder $builder) {
* @dataProvider provide_invalid_deeplink_builders
* @covers \mod_kialo\lti_flow::validate_deep_linking_response
*/
public function test_invalid_deep_link_response($signer, ?callable $builder, $exception) {
public function test_invalid_deep_link_response($signer, ?callable $builder, $exception): void {
// Given an invalid redirect GET request from Kialo with the deep linking response.
$this->prepare_deep_link_response_request($signer, $builder);

Expand Down
6 changes: 3 additions & 3 deletions tests/classes/moodle_cache_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*
* @covers \mod_kialo\static_nonce_generator
*/
class moodle_cache_test extends \basic_testcase {
final class moodle_cache_test extends \basic_testcase {
/**
* @var moodle_cache $cache
*/
Expand All @@ -61,7 +61,7 @@ protected function setUp(): void {
* @covers \mod_kialo\moodle_cache::storeItemInCache
* @covers \mod_kialo\moodle_cache::fetchObjectFromCache
*/
public function test_cache_gets_and_sets() {
public function test_cache_gets_and_sets(): void {
$this->assertFalse($this->cache->hasItem('key'));
$item = new CacheItem('key', true, 'value');
$this->assertTrue($this->cache->save($item));
Expand All @@ -77,7 +77,7 @@ public function test_cache_gets_and_sets() {
* @return void
* @throws \Psr\Cache\InvalidArgumentException
*/
public function test_clear_all_objects() {
public function test_clear_all_objects(): void {
$this->cache->save(new CacheItem('item1', true, 1));
$this->cache->save(new CacheItem('item2', true, 2));
$this->assertTrue($this->cache->hasItem('item1'));
Expand Down
4 changes: 2 additions & 2 deletions tests/classes/static_nonce_generator_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
* Tests the static nonce generator.
* @covers \mod_kialo\static_nonce_generator
*/
class static_nonce_generator_test extends \basic_testcase {
public function test_generator() {
final class static_nonce_generator_test extends \basic_testcase {
public function test_generator(): void {
$generator = new static_nonce_generator("NONCE1234");
$nonce = $generator->generate();

Expand Down
8 changes: 4 additions & 4 deletions tests/classes/static_registration_repository_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
* Tests the static registration repository.
* @covers \mod_kialo\static_registration_repository
*/
class static_registration_repository_test extends \basic_testcase {
final class static_registration_repository_test extends \basic_testcase {

/**
* Tests the static registration repository.
* @covers \mod_kialo\static_registration_repository::find
* @covers \mod_kialo\static_registration_repository::findAll
* @covers \mod_kialo\static_registration_repository::findByClientId
*/
public function test_repository() {
public function test_repository(): void {
$reg = kialo_config::get_instance()->create_registration("42");
$this->assertEquals("kialo-moodle-registration", $reg->getIdentifier());

Expand All @@ -57,7 +57,7 @@ public function test_repository() {
* Tests the static registration repository's findByPlatformIssuer method.
* @covers \mod_kialo\static_registration_repository::findByPlatformIssuer
*/
public function test_find_by_platform_issuer() {
public function test_find_by_platform_issuer(): void {
$reg = kialo_config::get_instance()->create_registration("42");
$repo = new static_registration_repository($reg);

Expand All @@ -69,7 +69,7 @@ public function test_find_by_platform_issuer() {
* Tests the static registration repository's findByToolIssuer method.
* @covers \mod_kialo\static_registration_repository::findByToolIssuer
*/
public function test_find_by_tool_issuer() {
public function test_find_by_tool_issuer(): void {
$reg = kialo_config::get_instance()->create_registration("42");
$repo = new static_registration_repository($reg);

Expand Down
Loading

0 comments on commit 6979414

Please sign in to comment.