From 6066f6c063af9622b005218976ed018b36254e42 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Tue, 6 Feb 2018 14:25:07 -0800 Subject: [PATCH] Declare LogFormatter::$parsedParameters property And rework LogFormatterTest so it doesn't need to access that property. Change-Id: I4d429430efe74dc083019a1a8bb07257785484b9 --- includes/logging/LogFormatter.php | 6 ++++++ tests/phpunit/includes/logging/LogFormatterTest.php | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/includes/logging/LogFormatter.php b/includes/logging/LogFormatter.php index bc0491f4cf..0ffe691d65 100644 --- a/includes/logging/LogFormatter.php +++ b/includes/logging/LogFormatter.php @@ -108,6 +108,12 @@ class LogFormatter { */ private $linkRenderer; + /** + * @see LogFormatter::getMessageParameters + * @var array + */ + protected $parsedParameters; + protected function __construct( LogEntry $entry ) { $this->entry = $entry; $this->context = RequestContext::getMain(); diff --git a/tests/phpunit/includes/logging/LogFormatterTest.php b/tests/phpunit/includes/logging/LogFormatterTest.php index e523a31e81..91ce9ea6c8 100644 --- a/tests/phpunit/includes/logging/LogFormatterTest.php +++ b/tests/phpunit/includes/logging/LogFormatterTest.php @@ -91,10 +91,11 @@ class LogFormatterTest extends MediaWikiLangTestCase { $formatter->setShowUserToolLinks( false ); $paramsWithoutTools = $formatter->getMessageParametersForTesting(); - unset( $formatter->parsedParameters ); - $formatter->setShowUserToolLinks( true ); - $paramsWithTools = $formatter->getMessageParametersForTesting(); + $formatter2 = LogFormatter::newFromEntry( $entry ); + $formatter2->setContext( $this->context ); + $formatter2->setShowUserToolLinks( true ); + $paramsWithTools = $formatter2->getMessageParametersForTesting(); $userLink = Linker::userLink( $this->user->getId(), -- 2.20.1