From 3abaca02ccd6aff75f84dd657edcbd734894a54f Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Fri, 12 Jul 2024 13:48:28 +0100 Subject: [PATCH] MDL-82444 core: skip environment test on optional plugin extensions. --- lib/tests/environment_test.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/tests/environment_test.php b/lib/tests/environment_test.php index ebadd7b8b0a..1043968acd3 100644 --- a/lib/tests/environment_test.php +++ b/lib/tests/environment_test.php @@ -26,7 +26,7 @@ use environment_results; * @copyright 2013 Petr Skoda {@link http://skodak.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class environment_test extends \advanced_testcase { +final class environment_test extends \advanced_testcase { /** * Test the environment check status. @@ -47,7 +47,7 @@ class environment_test extends \advanced_testcase { * * @return array */ - public function environment_provider() { + public static function environment_provider(): array { global $CFG; require_once($CFG->libdir.'/environmentlib.php'); @@ -75,6 +75,13 @@ class environment_test extends \advanced_testcase { $this->markTestSkipped('OPCache extension is not necessary for unit testing.'); } + if ($result->part === 'php_extension' + && $result->getPluginName() !== '' + && $result->getLevel() === 'optional' + && $result->getStatus() === false) { + $this->markTestSkipped('Optional plugin extension is not necessary for unit testing.'); + } + if ($result->part === 'custom_check' && $result->getLevel() === 'optional' && $result->getStatus() === false) {