TestCase::expectDeprecation() is deprecated in PHPUnit 10,
use mediawiki own MediaWikiTestCaseTrait::expectDeprecationAndContinue()
for this case. This avoids the trigger_error call and isolate the
deprecation check into MWDebug class.
The continue part is also helpful in StubGlobalUserTest, where after the
first deprecation access more code exists, that was not executed as
PhpUnit 9 converts deprecations to exceptions.
In RCFeedTest the exception needs to be catched as the code proceed
after the deprecation notice is emitted.
Bug: T342110
Change-Id: Iecf827bec0d5215fd21bbb20b84caf928ee108a0
The object watchstarsByTitle contains page titles as keys.
A normal object created by {} has some properties like hasOwnProperty.
This leads to problems if the page title has such a name like on
https://en.wiktionary.org/wiki/hasOwnProperty
This title with lower case letter is valid on the configuration:
$wgCapitalLinkOverrides[ NS_MAIN ] = false;
An object created by Object.create( null ) has no predefined
properties.
Bug: T342137
Change-Id: Id30b1918b0ddbc3f4abfb3b200168323d5d1bf21
remove $nonce parameter from ::getLoad(), access
the option directly in that method; unhoist variables
and reduce duplication.
Change-Id: If0aef56fa123105e5c98568cb95c09368d55b68e
I found myself needing to just get the stashes name without the
placeholder for T331397, and I thought that this seems like a weird
API. The caller should get the placeholder separately if desired,
which is easy to do in all of the current callers.
Follow-up to 65f04c763a.
Change-Id: Icf1d24f17b60a461ef682bc5da01be6ebc3a2d93
Only update test cases that tests non-deprecated functions.
Test cases that tests deprecated functions can be removed together with
the removal of the deprecated functions.
Also consistently use
$this->getServiceContainer()
instead of
MediaWikiServices::getInstance()
Change-Id: Iac40d6c66a31dd699ab8771244c701232e4354e8
A code comment says that this code is necessary to avoid warnings like
"No tests in class ...", but I wasn't able to reproduce the warning in
question.
This code was added in https://w.wiki/73Wv, in 2010. I guess PHPUnit
might have changed enough over the last 13 years to no longer emit this
warning.
A quick look at the TestSuite class suggests that the warning is not
emitted when the constructor is called with a string, which is what
we're doing.
Things might change in PHPUnit 10, but TestSuite::__construct was made
private, so I think we may have to rewrite our suites anyway.
Change-Id: Ie044900ffcffca9c8f0d96b425271a2eda90a5cd
Promote the deprecation to an error in the context of PHPUnit tests. The
point of hard deprecations is to make tests fail and this will help with
that, and also with eventually promoting the deprecation to an error
outside of tests.
Adjust code in parser tests that was accessing MediaWikiServices via
Title too early.
Avoid hack of resetting the error handler after loading Setup.php, and
conditionally install MW's hadler instead. This is particularly
important in scenarios where an exception is thrown before the handler
is reset, because MW's exception handler may also access
MediaWikiServices.
Bug: T227900
Bug: T273261
Change-Id: I7c5234046379cf4abd25d65e78c0a99ac9f32600
The service was previously accessing the global ExtensionRegistry
singleton, making it lose its statelessness. Dependencies should always
be injected, so add constructor parameters for that.
Simplify tests accordingly.
Change-Id: Iae375a81cab411fab607cba0addb2088131b3c81
The MediaWiki class is the quintessence of global state. I'm not even
sure if it's safe to run this test together with others. At any rate,
avoid using RequestContext::getMain(), given that the context is passed
in explicitly. And also reset global $wgTitle after the test, or any
value set in this test may persist forever.
Bug: T341951
Change-Id: I1a94c6ca2f335ee5a2d7d57df6dc46b65ca1f767
Do not assume that sysops don't have the hideuser right. That can be
changed in configuration. For instance, I have that in my local. Use an
appropriate authority without the 'hideuser' permission instead.
Also avoid overriding $wgGroupPermissions, and use an Authority instead.
Change-Id: I1c8b25965e41a1a0308dfbe0212c1c19deccb364
The leading "*" is currently used as the username pattern for temp
users, meaning this test will fail if
$wgAutoCreateTempUser['enabled'] = true;
Put the star at the end instead, and use a variable for the username
instead of repeating it multiple times.
Change-Id: Ie0414de5f9d9054dfec540f14bd0dc9ec7b4cb72
zh-hk respectively
* Merge zh-tw translations back to zh-hant
* Split zh-hans, zh-hant, zh-hk translations and aliases from zh to
respective message files
* Language->getNamespaceAliases() with the updated language fallback
chain can already fetch aliases from language variant i18n files
All translation authors are added when merging those translations.
Bug: T286291
Bug: T296188
Change-Id: Ia2aa17fa15fe6d6b9396bf06b472d28b3ab12f68
- Avoid huge hack in doStashOld by just faking the time, so that we
don't have to mess with the cache key.
- Disable temp users explicitly in tests that test anons.
- Add a TODO that the class should be expanded to test both scenarios
(temps and anons).
Bug: T341949
Change-Id: I1317be62b69e4cf6759012e6ea7d9c92c46765f4
This test assumes that the CachePages config setting is true, but that
may not be the case. The test already takes a config array, so we can
simply add the expected value there.
Also simplify the code a little bit with the `??=` operator.
Change-Id: Iecd5e3f5c83bab87aad666ef334cd692ee3a2c41