From 355662fb3462ff429e3ee75572d963f8320280aa Mon Sep 17 00:00:00 2001 From: Alexander Bias Date: Sun, 27 Oct 2024 15:26:27 +0100 Subject: [PATCH] Tests: Call parent setup() function when instantiating PHPUnit tests --- CHANGES.md | 4 ++++ tests/condition_test.php | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 99e9c30..9085d64 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,10 @@ moodle-availability_role Changes ------- +### Unreleased + +* 2024-10-27 - Tests: Call parent setup() function when instantiating PHPUnit tests. + ### v4.4-r1 * 2024-08-24 - Development: Rename master branch to main, please update your clones. diff --git a/tests/condition_test.php b/tests/condition_test.php index dde5e73..1364e71 100644 --- a/tests/condition_test.php +++ b/tests/condition_test.php @@ -38,9 +38,13 @@ final class condition_test extends \advanced_testcase { * Load required classes. */ public function setUp(): void { - // Load the mock info class so that it can be used. global $CFG; + + // Load the mock info class so that it can be used. require_once($CFG->dirroot . '/availability/tests/fixtures/mock_info.php'); + + // Call parent setup. + parent::setUp(); } /**