From 381c35718b13fa5e162a84c4d69db63d6cfb14aa Mon Sep 17 00:00:00 2001 From: Andy Vandenberghe Date: Sun, 4 Oct 2026 22:10:53 +0200 Subject: [PATCH] Give topic_likes_test the global $auth that censor_text() needs CI's bootstrap loads phpBB's real censor_text(), which reads global $auth; the global stub in the test file never applies there. The test set $config and $user but not $auth, so both cases errored with "Call to a member function acl_get() on null" on every CI job since #208. Set a mocked $auth as recenttopics_events_test already does. Co-Authored-By: Claude Opus 5.5 --- tests/core/topic_likes_test.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/core/topic_likes_test.php b/tests/core/topic_likes_test.php index 9d9a3bf..2e36d74 100644 --- a/tests/core/topic_likes_test.php +++ b/tests/core/topic_likes_test.php @@ -138,9 +138,14 @@ public function get_topic_like_counts(array $topic_ids) $property->setValue($rt, $value); } + // phpBB's real censor_text() (loaded by the test bootstrap) reads global $config, $user and + // $auth. allow_nocensors = 1 with acl_get() = true leaves the text untouched. $GLOBALS['phpbb_dispatcher'] = $dispatcher; $GLOBALS['config'] = ['allow_smilies' => 0, 'allow_nocensors' => 1]; $GLOBALS['user'] = $user; + $auth_global = $this->createMock(\phpbb\auth\auth::class); + $auth_global->method('acl_get')->willReturn(true); + $GLOBALS['auth'] = $auth_global; return $rt; }