* Remove redundant file closure.
* Remove needless QUnit.newMwEnvironment() calls as the tested
methods don't alter mw.config or mw.messages. Slow, as per
https://gerrit.wikimedia.org/r/c/mediawiki/core/+/912936/
Change-Id: I61bf03325d5067568d057ff2af6bf65f279a8a84
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
* Declare variables inline, as per the current code conventions.
* Convert ad-hoc cases objects into native QUnit.test.each().
This makes for shorter and cleaner code, as well as for more
detailed test reporting, and removes the need to manually construct
assertion messages based on test case prefix string etc.
* Start adopting ES5 Array.forEach in a few places where otherwise
ESLint would complain about variable name clashes.
* Future proof the test module names, by stripping the global variable
namespace that some classes still use, matching packageFiles convention
as used for NotificationBadge.js and its tests already, by specifying
only the bundle name and the exported class name. Note that the
QUnit UI does fuzzy matching so filtering works the same either
way, e.g. "echodmfilter" will match "ext.echo.dm - FilterModel".
Change-Id: I49858dd2c95d0869f2cd15693f05c38312a9f710
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
== Problem 1 ==
As of I09c27a084100b223, tests/qunit/index.js or equiv was used to
load test files asynchronously from a using() callback. This was
untracked by RL or QUnit, and thus sometimes ended up finishing after
the test runner was already done executing all tests. In CI this
means the tests are sometimes never loaded and the browser (or Node)
process already killed before they even have a chance to arrive.
Prior to QUnit 2.17, this was no way of detecting this. As of
QUnit 2.17 (core upgraded last week) when running tests manually
the following helpful warnings appear in the console:
> [warning] Unexpected test after runEnd.
> [warning] This is unstable and will fail in QUnit 3.0.
> test @ qunit.js
> tests/qunit/model/test_mw.echo.dm.SeenTimeModel.js
> require
There were about 1072 instances of this warning, all from Echo.
Fix this problem by removing the async callbacks and specifying the
two modules as normal dependencies instead.
== Problem 2 ==
Class NotificationBadge was being loaded in a strange way out of
bound. This was a violation of module boundaries and should not be
needed other than for a temporary hack or other tech debt. More
generally when a test uses `packageFiles` this is a likely sign of
tech debt or misunderstandings.
Instead, depend on `ext.echo.mobile` and export/import the class
as normal.
After this, the test module can use `scripts` instead.
== Problem 3 ==
The `ext.echo.mobile` uses a Mustache template which the test
was also duplicating a reference to. This is no longer needed now.
Due to the `qunit/index.js` file carefully splitting the operations
between template assignment and file loading, I wondered whether
it was meaning to replace or mock it with something else, but it
simply refers to the same file and only does this because it wasn't
using the module directly. This is now resolved.
If you do need to mock in the future, this can simply be done
by assigning `NotificationBadge.prototype.template` from a
beforeEach() callback in the test suite, or by supporting it
property as a constructor option in NotificationBadge.js and
assigning `this.template` there, which is supported by the
mobile `View` class already it seems and would follow DI patterns
more effectively.
== Problem 4 ==
Most of the Echo tests were ignored sometimes and executed other
times.
The test for `ext.echo.mobile` in particular though was never
executed in CI specifically because:
> Undefined module: 'mobile.startup'
This became a hard error with this patch, which is fixed by
the CI config change with Ie9dabe3269c56fa76db8e51.
Bug: T299780
Change-Id: Ie4a87f3b8085fd6ae53ec586c1782cc266d5288a
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