diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2025-05-09 12:23:25 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2025-05-09 15:15:35 +0200 |
commit | 7cb8a56b6a6c9f928c7a0e7f00e719770af1b823 (patch) | |
tree | bba2c82cb0ed4c45aead0c4a2310dc9843e37eaf /tests | |
parent | a48a72d1cd76fd5c8e343f3f8f73a27a0e920f81 (diff) | |
download | volse-hubzilla-7cb8a56b6a6c9f928c7a0e7f00e719770af1b823.tar.gz volse-hubzilla-7cb8a56b6a6c9f928c7a0e7f00e719770af1b823.tar.bz2 volse-hubzilla-7cb8a56b6a6c9f928c7a0e7f00e719770af1b823.zip |
Don't access APP:$observer directly in core
Introduce helper functions to access the various fields of the xchan
stored in `App::$observer'. This removes direct access to the attribute
from core, with the aim of allowing further refactoring later.
We can not yet make the `App::$observer` attribute private, though, as
it is also accessed directly by some addons.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/Module/MagicTest.php | 8 | ||||
-rw-r--r-- | tests/unit/includes/BBCodeTest.php | 7 |
2 files changed, 8 insertions, 7 deletions
diff --git a/tests/unit/Module/MagicTest.php b/tests/unit/Module/MagicTest.php index 4a03d9d57..2c426bf76 100644 --- a/tests/unit/Module/MagicTest.php +++ b/tests/unit/Module/MagicTest.php @@ -46,9 +46,9 @@ class MagicTest extends TestCase { App::set_baseurl($baseurl); - App::$observer = [ + App::set_observer([ 'xchan_hash' => 'the hash', - ]; + ]); // We pass a local URL, and have a valid observer, but as the // delegate param is not passed, nothing will be done except @@ -72,9 +72,9 @@ class MagicTest extends TestCase { App::$timezone = 'UTC'; // Simulate a foreign (to this hub) observer, - App::$observer = [ + App::set_observer([ 'xchan_hash' => 'foreign hash', - ]; + ]); // Create the channel the foreign observer wants to access $result = create_identity([ diff --git a/tests/unit/includes/BBCodeTest.php b/tests/unit/includes/BBCodeTest.php index 136fc6e0e..50475efea 100644 --- a/tests/unit/includes/BBCodeTest.php +++ b/tests/unit/includes/BBCodeTest.php @@ -23,6 +23,7 @@ namespace Zotlabs\Tests\Unit\includes; +use App; use Zotlabs\Tests\Unit\UnitTestCase; class BBCodeTest extends UnitTestCase { @@ -42,7 +43,7 @@ class BBCodeTest extends UnitTestCase { */ public function test_bbcode_observer(string $src, bool $logged_in, string $lang, string $expected): void { if ($logged_in) { - \App::$observer = [ + App::set_observer([ 'xchan_addr' => '', 'xchan_name' => '', 'xchan_connurl' => '', @@ -50,9 +51,9 @@ class BBCodeTest extends UnitTestCase { // port required in xchan url due to bug in get_rpost_path 'xchan_url' => 'https://example.com:666', - ]; + ]); } else { - \App::$observer = null; + App::set_observer(null); } \App::$language = $lang; |