From f0aa52f75e5bb11f87d2521b770e8d5e3ca057ec Mon Sep 17 00:00:00 2001 From: Meirza Date: Fri, 24 Mar 2023 16:09:43 +0700 Subject: [PATCH] MDL-77350 search: Added class properties that are not declared 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. --- search/classes/base.php | 7 +++++ search/classes/base_activity.php | 3 +++ .../simpledb/tests/privacy/provider_test.php | 27 +++++++++++++++++++ search/tests/fixtures/mock_search_engine.php | 3 +++ 4 files changed, 40 insertions(+) diff --git a/search/classes/base.php b/search/classes/base.php index c3678125ff1eb..f73238e569f18 100644 --- a/search/classes/base.php +++ b/search/classes/base.php @@ -66,6 +66,13 @@ abstract class base { */ protected static $levels = [CONTEXT_SYSTEM]; + /** + * An area id from the componentname and the area name. + * + * @var string + */ + public $areaid; + /** * Constructor. * diff --git a/search/classes/base_activity.php b/search/classes/base_activity.php index 713fa6d813c8b..8519b5bdf987b 100644 --- a/search/classes/base_activity.php +++ b/search/classes/base_activity.php @@ -54,6 +54,9 @@ abstract class base_activity extends base_mod { */ protected static $levels = [CONTEXT_MODULE]; + /** @var array activity data instance. */ + public $activitiesdata = []; + /** * Returns recordset containing all activities within the given context. * diff --git a/search/engine/simpledb/tests/privacy/provider_test.php b/search/engine/simpledb/tests/privacy/provider_test.php index 17d250a6da44f..9bc628fb36f01 100644 --- a/search/engine/simpledb/tests/privacy/provider_test.php +++ b/search/engine/simpledb/tests/privacy/provider_test.php @@ -42,6 +42,33 @@ */ class provider_test extends \core_privacy\tests\provider_testcase { + /** @var \search_simpledb\engine database engine. */ + protected $engine; + + /** @var \testable_core_search core search class adapted to unit test. */ + protected $search; + + /** @var \core_search_generator core search generator class adapted to unit test. */ + protected $generator = null; + + /** @var \stdClass course record.*/ + protected $c1; + + /** @var \stdClass course record.*/ + protected $c2; + + /** @var \context_course context instance. */ + protected $c1context; + + /** @var \context_course context instance. */ + protected $c2context; + + /** @var \stdClass user record. */ + protected $u1; + + /** @var \stdClass user record. */ + protected $u2; + public function setUp(): void { global $DB; diff --git a/search/tests/fixtures/mock_search_engine.php b/search/tests/fixtures/mock_search_engine.php index 20f4d3e93dd65..6e51b6997ad2a 100644 --- a/search/tests/fixtures/mock_search_engine.php +++ b/search/tests/fixtures/mock_search_engine.php @@ -40,6 +40,9 @@ class engine extends \core_search\engine { /** @var array Schema updates applied */ protected $schemaupdates = []; + /** @var array delete of course index. */ + protected $deletes = []; + public function is_installed() { return true; }