From a3014530acf8e962246a8e6d1b21d9380360efd4 Mon Sep 17 00:00:00 2001 From: Dmitrii Metelkin Date: Fri, 19 Aug 2022 11:16:11 +1000 Subject: [PATCH 1/3] Add @covers to all tests --- tests/auth_plugin_test.php | 2 ++ tests/core_userkey_manager_test.php | 2 ++ tests/externallib_test.php | 2 ++ 3 files changed, 6 insertions(+) diff --git a/tests/auth_plugin_test.php b/tests/auth_plugin_test.php index c17493d..adf2f37 100644 --- a/tests/auth_plugin_test.php +++ b/tests/auth_plugin_test.php @@ -26,6 +26,8 @@ use external_value; /** * Tests for auth_plugin_userkey class. * + * @covers auth_plugin_userkey + * * @package auth_userkey * @copyright 2016 Dmitrii Metelkin (dmitriim@catalyst-au.net) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later diff --git a/tests/core_userkey_manager_test.php b/tests/core_userkey_manager_test.php index fa113a7..96c135a 100644 --- a/tests/core_userkey_manager_test.php +++ b/tests/core_userkey_manager_test.php @@ -22,6 +22,8 @@ namespace auth_userkey; * Key validation is fully covered in auth_plugin_test.php file. * TODO: write tests for validate_key() function. * + * @covers core_userkey_manager + * * @package auth_userkey * @copyright 2016 Dmitrii Metelkin (dmitriim@catalyst-au.net) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later diff --git a/tests/externallib_test.php b/tests/externallib_test.php index 1148b2b..77081fb 100644 --- a/tests/externallib_test.php +++ b/tests/externallib_test.php @@ -27,6 +27,8 @@ use context_system; /** * Tests for externallib.php. * + * @covers auth_userkey_external + * * @package auth_userkey * @copyright 2016 Dmitrii Metelkin (dmitriim@catalyst-au.net) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later From 992ecf4c5f85eb8d81d0502fb7851fa7f77ffc62 Mon Sep 17 00:00:00 2001 From: Dmitrii Metelkin Date: Fri, 19 Aug 2022 11:18:20 +1000 Subject: [PATCH 2/3] Fix minor CI complains --- auth.php | 2 +- classes/core_userkey_manager.php | 2 +- version.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/auth.php b/auth.php index e05f7f5..0f29683 100644 --- a/auth.php +++ b/auth.php @@ -112,7 +112,7 @@ class auth_plugin_userkey extends auth_plugin_base { * @throws \moodle_exception If gets running via CLI or AJAX call. */ protected function redirect($url) { - if (CLI_SCRIPT or AJAX_SCRIPT) { + if (CLI_SCRIPT || AJAX_SCRIPT) { throw new moodle_exception('redirecterrordetected', 'auth_userkey', '', $url); } diff --git a/classes/core_userkey_manager.php b/classes/core_userkey_manager.php index 83e7c0b..bb05ed5 100644 --- a/classes/core_userkey_manager.php +++ b/classes/core_userkey_manager.php @@ -117,7 +117,7 @@ class core_userkey_manager implements userkey_manager_interface { throw new \moodle_exception('invalidkey'); } - if (!empty($key->validuntil) and $key->validuntil < time()) { + if (!empty($key->validuntil) && $key->validuntil < time()) { throw new \moodle_exception('expiredkey'); } diff --git a/version.php b/version.php index eef3b4a..95b0b6a 100644 --- a/version.php +++ b/version.php @@ -24,7 +24,7 @@ defined('MOODLE_INTERNAL') || die; -$plugin->version = 2022081900; // The current plugin version (Date: YYYYMMDDXX) +$plugin->version = 2022081900; // The current plugin version (Date: YYYYMMDDXX). $plugin->release = 2022081900; // Match release exactly to version. $plugin->requires = 2017051500; // Requires Moodle 3.3 version. $plugin->component = 'auth_userkey'; // Full name of the plugin (used for diagnostics). From 4ab1cdc81db7da09ad19d693c2482d96b25bd994 Mon Sep 17 00:00:00 2001 From: Dmitrii Metelkin Date: Fri, 19 Aug 2022 11:37:34 +1000 Subject: [PATCH 3/3] Update @covers annotation --- tests/auth_plugin_test.php | 2 +- tests/core_userkey_manager_test.php | 2 +- tests/externallib_test.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auth_plugin_test.php b/tests/auth_plugin_test.php index adf2f37..8e8f64f 100644 --- a/tests/auth_plugin_test.php +++ b/tests/auth_plugin_test.php @@ -26,7 +26,7 @@ use external_value; /** * Tests for auth_plugin_userkey class. * - * @covers auth_plugin_userkey + * @covers \auth_plugin_userkey * * @package auth_userkey * @copyright 2016 Dmitrii Metelkin (dmitriim@catalyst-au.net) diff --git a/tests/core_userkey_manager_test.php b/tests/core_userkey_manager_test.php index 96c135a..a5d1709 100644 --- a/tests/core_userkey_manager_test.php +++ b/tests/core_userkey_manager_test.php @@ -22,7 +22,7 @@ namespace auth_userkey; * Key validation is fully covered in auth_plugin_test.php file. * TODO: write tests for validate_key() function. * - * @covers core_userkey_manager + * @covers \auth_userkey\core_userkey_manager * * @package auth_userkey * @copyright 2016 Dmitrii Metelkin (dmitriim@catalyst-au.net) diff --git a/tests/externallib_test.php b/tests/externallib_test.php index 77081fb..ce42203 100644 --- a/tests/externallib_test.php +++ b/tests/externallib_test.php @@ -27,7 +27,7 @@ use context_system; /** * Tests for externallib.php. * - * @covers auth_userkey_external + * @covers \auth_userkey_external * * @package auth_userkey * @copyright 2016 Dmitrii Metelkin (dmitriim@catalyst-au.net)