Singletons are bad, amongst other reasons, because they're never reset
in tests. They can therefore occasionally cause test failures if the
cached data stored in one of these singletons becomes stale.
As noted on the task, ideally these two classes shouldn't exist at all,
and core should be responsible for caching the information it deems
expensive to compute.
As a temporary (TM) workaround, make both classes actual services, so
that the setUp/tearDown logic in MediaWikiIntegrationTestCase can
properly reset them between tests.
Dependencies are intentionally not being injected, precisely because
these classes should just be deleted, not improved.
Bug: T344124
Change-Id: I58b8d9610f9447468235b94d25732528ab6acce6
The test was assuming that the ID 1 belongs to a user other than the one
being created in the test. This is not necessarily the case, so make it
use an ID that is guaranteed to be different.
Also rename the test fail to avoid a PHPUnit deprecation of test class
name not matching file name.
Bug: T342428
Change-Id: Ied1869e380b023c1a726a5be610e1de1b68c78c0
The test doesn't need the database, but it's currently trying to use it.
Mock all services used by EchoDbFactory to avoid that (the Factory
cannot be mocked directly because it's created with a static method and
not injected).
Change-Id: I359489ed3f8de6e868a590d5c7c02f81f0a2049d
Use mocks when possible, and add the test to the Database group
otherwise.
Also rename 2 test files to avoid a PHPUnit deprecation of file name not
matching class name.
Change-Id: I16b2392daf01f63511c82b4ed0e67a38e35ddbe1
When calling editPage() with a string it converts it to a WikiPage each
time it is called. When edit a page only once that is okay,
but when adding more revision to the same page it is better to pass a
WikiPage instead to allow reuse of internal states of WikiPage to speed
up the tests
Change-Id: Iac4ef3a3838ba22cd98b944e3ac7f596d540b405
Test ServiceWiring.php using tests copied from CentralAuth. Because
phpunit does not support marking a file as covered, the ServiceWiring
file is ignored for code coverage as the tests should partly cover
the file.
Change-Id: I3ea5ae553d17e17680fcac4d92746fc7ce282eaa
- Don't manipulate $wgHooks directly, use setTemporaryHook.
- Avoid premature access to MediaWikiServices from data providers
- use overrideSettings instead of setMwGlobals
Needed-By: I0ebba9a29f81b0d86ad8fd84d478fb244f9e9c15
Change-Id: I52b9251793a5d559658fcf1e0d20f5a497e5fc43
Notably: any() is the default anyway. It doesn't really make the
tests more specific or better readable when we repeat it all the
time.
Change-Id: I56d201bfce454587b00015b7208f313dd8ed9624
fixes:
ContainmentSetTest::testCachedListInnerListIsOnlyCalledOnce
strtr(): Passing null to parameter #1 ($string) of type string is deprecated
Change-Id: I9bb916383eda1176a2d56c06770a60c28431dfda
Replaced WikiPage::newFromID with newFromTitle,
because a Title object exists and could be reused
Bug: T297688
Change-Id: Ide30f259477ed8e0b48df31f5a23cafeb38d7316
The default timestamp of 00000000000000 cannot represent as timestamp,
because it gets a negative timestamp -00011130000000
This is needed for proper cross-RDBMS support
This reapply a change from I46206e0b3a687dff3168a81cf0020e669133e876,
reverted with I1c8c409b7820512b3e31246a7f3d8c1cf4db209c.
Bug: T244898
Change-Id: I109b783de0a8d60ccb161b280ce5fa09e145017b
Moved the factory deeper into the code right before the one usage it
still needed a full user object
Narrow done method arguments from User to UserIdentity
and use the identity directly
Change-Id: Ic118f23ef504c7fda892480df61ea68c10915f78
The section titles are wikitext extracted from inside heading markup
like `== … ==`, so start-of-line markup like `*` should not be parsed.
Bug: T299572
Change-Id: Ie3995b943e5fe20ad86041d6be755f14f32eb01e