diff options
author | Bartosz Dziewoński <matma.rex@gmail.com> | 2017-11-13 17:42:04 +0100 |
---|---|---|
committer | Bartosz Dziewoński <matma.rex@gmail.com> | 2017-11-15 11:04:52 +0000 |
commit | eed3cf7747dd9d183b62f2550c741584093e6373 (patch) | |
tree | b0a0da11de4312fb705dde9edb840b9152ebb9a7 /tests/phpunit/includes/PreferencesTest.php | |
parent | f1ca6b8ca9c2dc65014bc8ae79f02158d2dc52c3 (diff) | |
download | mediawikicore-eed3cf7747dd9d183b62f2550c741584093e6373.tar.gz mediawikicore-eed3cf7747dd9d183b62f2550c741584093e6373.zip |
Preferences: Remove unwise caching of Preferences::getPreferences()
The result of this function depends on the $user and $context
parameters (e.g. it includes the username from the user, and
localisation messages the language from the context). However,
both of them would be ignored if the result was cached, even
if calling with a different $user or $context.
Rather than make this more complicated just remove the caching.
This is not a hot code path: this function is not called at all
on normal page views, it's called just once when viewing
preferences, and at most twice when saving them.
Change-Id: I92390120a16448383a25e9ba2dd35a434a2f21bf
Diffstat (limited to 'tests/phpunit/includes/PreferencesTest.php')
-rw-r--r-- | tests/phpunit/includes/PreferencesTest.php | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/tests/phpunit/includes/PreferencesTest.php b/tests/phpunit/includes/PreferencesTest.php index b25e046d424a..4a152253db0e 100644 --- a/tests/phpunit/includes/PreferencesTest.php +++ b/tests/phpunit/includes/PreferencesTest.php @@ -150,20 +150,9 @@ class PreferencesTest extends MediaWikiTestCase { /** Helper */ protected function prefsFor( $user_key ) { - // TODO This should use Preferences::getPreferences() instead of calling internal methods. - // Unfortunately that currently ignores the $user parameter if it has cached data, even for - // a different user... - OutputPage::setupOOUI( - strtolower( $this->context->getSkin()->getSkinName() ), - $this->context->getLanguage()->getDir() - ); - $preferences = []; - Preferences::profilePreferences( + return Preferences::getPreferences( $this->prefUsers[$user_key], - $this->context, - $preferences + $this->context ); - - return $preferences; } } |