MDL-82444 core: skip environment test on optional plugin extensions.

This commit is contained in:
Paul Holden 2024-07-12 13:48:28 +01:00
parent 57fc94747d
commit 384300011c
No known key found for this signature in database
GPG Key ID: A81A96D6045F6164

View File

@ -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) {