From d7a22cdaf080949e08efaeace6aeacebc8c3a74a Mon Sep 17 00:00:00 2001 From: Oscar Nadjar Date: Mon, 4 Apr 2022 13:41:54 +0000 Subject: [PATCH] INT-17886: Fix code checker 3.1.0 --- classes/aws_apcu_cache.php | 4 +--- classes/aws_sdk.php | 4 +--- classes/privacy/provider.php | 4 +--- tests/aws_apcu_cache_test.php | 6 ++---- tests/aws_sdk_test.php | 12 +++++------- version.php | 2 +- 6 files changed, 11 insertions(+), 21 deletions(-) diff --git a/classes/aws_apcu_cache.php b/classes/aws_apcu_cache.php index 6457487..d32cc16 100644 --- a/classes/aws_apcu_cache.php +++ b/classes/aws_apcu_cache.php @@ -26,8 +26,6 @@ use Aws\CacheInterface; -defined('MOODLE_INTERNAL') || die(); - /** * An APCu cache for AWS. * @@ -92,4 +90,4 @@ public function set($key, $value, $ttl = 0) { public function remove($key) { apcu_delete($key); } -} \ No newline at end of file +} diff --git a/classes/aws_sdk.php b/classes/aws_sdk.php index ba6bfdd..52200ec 100644 --- a/classes/aws_sdk.php +++ b/classes/aws_sdk.php @@ -24,8 +24,6 @@ namespace local_aws_sdk; -defined('MOODLE_INTERNAL') || die(); - /** * Utility to help use the AWS SDK. * @@ -116,4 +114,4 @@ private static function resolve_credentials($name, array $cfg) { return []; } -} \ No newline at end of file +} diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php index 6fa38e0..dce9364 100644 --- a/classes/privacy/provider.php +++ b/classes/privacy/provider.php @@ -24,8 +24,6 @@ namespace local_aws_sdk\privacy; -defined('MOODLE_INTERNAL') || die(); - /** * Privacy Subsystem for local_aws_sdk implementing null_provider. * @@ -43,4 +41,4 @@ class provider implements \core_privacy\local\metadata\null_provider { public static function get_reason() : string { return 'privacy:metadata'; } -} \ No newline at end of file +} diff --git a/tests/aws_apcu_cache_test.php b/tests/aws_apcu_cache_test.php index 7b9202c..ccd2b1f 100644 --- a/tests/aws_apcu_cache_test.php +++ b/tests/aws_apcu_cache_test.php @@ -21,13 +21,11 @@ * @copyright Copyright (c) 2017 Open LMS (https://www.openlms.net) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ - +namespace local_aws_sdk; use Aws\Credentials\Credentials; use local_aws_sdk\aws_apcu_cache; use local_aws_sdk\aws_sdk; -defined('MOODLE_INTERNAL') || die(); - /** * Tests for APCu cache. * @@ -35,7 +33,7 @@ * @copyright Copyright (c) 2017 Open LMS (https://www.openlms.net) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class local_aws_sdk_aws_apcu_cache_testcase extends advanced_testcase { +class aws_apcu_cache_test extends \advanced_testcase { const TEST_KEY = 'phpunit_local_aws_sdk_test'; diff --git a/tests/aws_sdk_test.php b/tests/aws_sdk_test.php index f2a66f1..4dc8d5d 100644 --- a/tests/aws_sdk_test.php +++ b/tests/aws_sdk_test.php @@ -21,12 +21,10 @@ * @copyright Copyright (c) 2017 Open LMS (https://www.openlms.net) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ - +namespace local_aws_sdk; use local_aws_sdk\aws_apcu_cache; use local_aws_sdk\aws_sdk; -defined('MOODLE_INTERNAL') || die(); - /** * Tests SDK class. * @@ -34,7 +32,7 @@ * @copyright Copyright (c) 2017 Open LMS (https://www.openlms.net) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class local_aws_sdk_aws_sdk_testcase extends advanced_testcase { +class aws_sdk_test extends \advanced_testcase { /** * Test various use cases for creating config. * @@ -56,7 +54,7 @@ public function test_config_from_cfg($cfg, $expected) { * Test error handling for missing CFG value. */ public function test_config_from_cfg_missing_cfg() { - $this->expectException(coding_exception::class); + $this->expectException(\coding_exception::class); aws_sdk::config_from_cfg('asdf_asdf_hodor'); } @@ -70,7 +68,7 @@ public function test_config_from_cfg_not_array() { $CFG->phpunit_local_aws_sdk_test = 'hodor'; - $this->expectException(coding_exception::class); + $this->expectException(\coding_exception::class); aws_sdk::config_from_cfg('phpunit_local_aws_sdk_test'); } @@ -87,7 +85,7 @@ public function test_config_from_cfg_unknown_cache() { 'credentials_cache' => 'hodor', ]; - $this->expectException(coding_exception::class); + $this->expectException(\coding_exception::class); aws_sdk::config_from_cfg('phpunit_local_aws_sdk_test'); } diff --git a/version.php b/version.php index 5608340..9b5c8fe 100644 --- a/version.php +++ b/version.php @@ -29,4 +29,4 @@ $plugin->requires = 2015051100; $plugin->component = 'local_aws_sdk'; $plugin->maturity = MATURITY_STABLE; -$plugin->release = '3.1.3 (Build: 20161114)'; \ No newline at end of file +$plugin->release = '3.1.3 (Build: 20161114)';