MDL-78167 lib: Added missing class properties in tests

In PHP 8.2 and later, setting a value to an undeclared class property is
deprecated and emits a deprecation notice.
So we need to add missing class properties that still need to be declared.

Adding @runTestsInSeparateProcesses and removing setUp() and tearDown() at the
component_test.php, so the test will run in a separate process making sure that
whatever changes happen to the in-memory version of the component class in its thread,
therefore does not impact other tests and makes it more safe.
This commit is contained in:
Meirza
2023-05-27 09:24:59 +07:00
parent 4ed782dd03
commit b7008d33ea
7 changed files with 39 additions and 32 deletions
+1 -3
View File
@@ -711,7 +711,6 @@ class exposed_global_navigation extends global_navigation {
$page = $PAGE;
}
parent::__construct($page);
$this->cache = new navigation_cache('unittest_nav');
}
public function __call($method, $arguments) {
if (strpos($method, $this->exposedkey) !== false) {
@@ -763,9 +762,9 @@ class mock_initialise_global_navigation extends global_navigation {
*/
class exposed_navbar extends navbar {
protected $exposedkey = 'exposed_';
public function __construct(\moodle_page $page) {
parent::__construct($page);
$this->cache = new navigation_cache('unittest_nav');
}
public function __call($method, $arguments) {
if (strpos($method, $this->exposedkey) !== false) {
@@ -793,7 +792,6 @@ class exposed_settings_navigation extends settings_navigation {
public function __construct() {
global $PAGE;
parent::__construct($PAGE);
$this->cache = new navigation_cache('unittest_nav');
}
public function __call($method, $arguments) {
if (strpos($method, $this->exposedkey) !== false) {