This applies JSON Schema validation in phpunit tests where appropriate:
1) In ModuleSpecHandlerTest, the generated OpenApi specs are validated
against the OpenAPI 3 schema.
2) In RestStructureTest, module definition files are validated against
the mwapi schema.
This patch introduces a new trait to make it easy for phpunit test cases
to perform validation.
This patch also fixes some issues with the docs/rest/mwapi-1.0.json
schema and the includes/Rest/content.v1.json module definition.
Change-Id: I966cddb337c9373ed3a369496548a8d8c538ae84
Developers can use this to test their local version of Codex with
MediaWiki by pointing $wgCodexDevelopmentDir to their local clone of the
Codex repo, e.g. $wgCodexDevelopmentDir = '/home/yourname/git/codex';
Setting $wgCodexDevelopmentDir affects where the following things come
from:
- Codex JS/CSS files for the full library
- Codex JS/CSS files for code-split chunks, and the manifest.json file
that points to them
- Icons retrieved by CodexModule::getIcons()
- CSS-only icons imported in Less
- Design tokens imported in Less
Other changes in this patch:
- Add CodexModule::makeFilePath() to centralize the repeated path
concatenation. This makes it easier to switch out the regular path for
the dev mode path.
- Replace all uses of $IP (which is deprecated) and MW_INSTALL_PATH in
CodexModule with the BaseDirectory config setting.
- Make CodexModule::getIcons() reset its static cache if the path to the
icons file changes. Without this, it's impossible to make the unit
tests pass.
- Move the i18n messages code from the CodexModule constructor to
getMessages(). It can't be in the constructor because makeFilePath()
doesn't work there (it fails because the Config object hasn't been set
up yet).
- Add a 'mediawiki.skin.codex' import path so that we can stop
hard-coding the path to the Codex mixins file. Without this, we can't
make the Codex mixins come from the right place in development mode.
- Consider $wgCodexDevelopmentDir in setting the cache key for compiled
Less code, since changing this setting can change the output of Less
compilation (by changing design tokens, icons or mixins).
- Add unit tests for (the non-dev mode behavior of)
CodexModule::getIcons() and the i18n message key handling.
Bug: T314507
Change-Id: I11c6a81a1ba34fe10f4b1c98bf76f0db40c1ce98
CODEX_MODULE_DIR is always the /modules subdirectory of
CODEX_LIBRARY_DIR, so remove it and derive it that way instead.
- Update tests accordingly
- Rename test data files accordingly
- Use CODEX_LIBRARY_DIR in one place where we had neglected to use a
constant
Change-Id: Ieb347c2d128f3addfb11f6aca79d63969434f342
This requires the path to the Codex modules directory
to be configurable, so we can use static manifest and
component files in tests. This is achieved by changing
the constant storing the Codex modules dir from private
to protected so it can be overridden when creating a
test module.
Bug: T350054
Change-Id: Icd3c6c5d2a82f5a5fb1c38b52e54893034e7375c
Analogous to what the 'compat/compat' rule indicates already, and the
fact that CI, fresh-node, and local dev generally involves recent
versions of Firefox, Chromium-based browsers, or Safari.
This patch is a minimal first step that only loosens the linter,
and auto-fixing only unusual cases where a new rule specifically
warned against existing code.
Change-Id: Ic64f650bd64669c57b884de3f75b23f3549b0c9f
The doc folder contains (committed) json files with schema definition
for json files
That should be linted as well to spot syntax errors easier
Change-Id: I20ff7abf6b98d2247ee52e2d2b43af88c062f779
A `SettingsSource` is meant to represent any kind of local or remote
store from which settings can be read, be this a local file, remote URL,
database, etc. It is concerned with reading in (and possibly decoding)
settings data, and computing a consistent hash key that may be used in
caching.
A `SettingsFormat` is meant to detect supported file types and/or decode
source contents into settings arrays. As of now, JSON is the only
supported format but others may be implemented.
`FileSource` is the first source implementation, with its default format
being JSON, meant to read settings from local JSON files.
`ArraySource` is mostly useful for testing using array literals.
Refactored `SettingsBuilder` methods to use the new source abstractions.
Bug: T295499
Change-Id: If7869609c4ad1ccd0894d5ba358f885007168972
* Move data files to /data
* Add benchmarkCommentFormatter, named for the new class hierarchy.
Bug: T285917
Change-Id: Idf2529894fe63d34087d6d5ce4dd1676c89b1373
Adds the MDN polyfills for Array.prototype.find, findIndex, and
includes to core, along with a skip function. Polyfills live a
single "es6-polyfills" module in case additional similar polyfills
need to be introduced in the future.
Introducing these in core will allow certain extensions
to stop shipping local copies.
Bug: T264135
Change-Id: I37953f6fcad693a8d25e1a19764abd55bbbbb242