wiki.techinc.nl/tests/phpunit/includes
Timo Tijhof d0a96db0f9 parser: Move lang/dir and mw-content-ltr to ParserOutput::getText
== Skin::wrapHTML ==

Skin::wrapHTML no longer has to perform any guessing of the
ParserOutput language. Nor does it have to special wiki pages vs
special pages in this regard. Yay, code removal.

== ImagePage ==

On URLs like /wiki/File:Example.jpg, the main output handler is
ImagePage::view. This calls the parent Article::view to handle most of
its output. Article::view obtains the ParserOptions, and then fetches
ParserOutput, and then adds `<div class=mw-parser-output>` and its
metadata to OutputPage.

Before this change, ImagePage::view was creating a wrapper based
on "predicting" what language the ParserOutput will contain. It
couldn't call the new OutputPage::getContentLanguage or some
equivalent as Article::view wouldn't have populated that yet.

This leaky abstraction is fixed by this change as now the `<div>`
from ParserOutput no longer comes with a "please wrap it properly"
contract that Article subclasses couldn't possibly implement correctly
(it coudln't wrap it after the fact because Article::view writes to
OutputPage directly).

RECENT (T310445):

A special case was recently added for file pages about translated SVGs.
For those, we decide which language to use for the "fullMedia" thumb
atop the page. This was recently changed as part of T310445 from a
hardcoded $wgLanguageCode (site content lang) to new problematic
Title::getPageViewLanguage, which tries to guestimate the page
language of the rendered ParserOutput and then gets the preferred
variant for the current user. The motivation for this was to support
language variants but used Title::getPageViewLanguage as a kitchen
sink to achieve that minor side-effect. The only part of this
now-deprecated method that we actually need is
LanguageConverter::getPreferredVariant().

Test plan: Covered by ImagePageTest.

== Skin mainpage-title ==

RECENT (T331095, T298715):

A special case was added to Skin::getTemplateData that powers the
mainpage-title interface message feature. This is empty by default,
but when created via MediaWiki:mainpage-title allows interface admins
to replace the H1 with a custom and localised page heading.

A few months ago, in Ifc9f0a7174, Title::getPageViewLanguage was
applied here to support language variants. Replace with the same
fix as for ImagePage. Revert back to Message::inContentLanguage()
but refactor to inLanguage() via MediaWikiServices::getContentLanguage
so that LanguageConverter::getPreferredVariant can be applied.

== EditPage ==

This was doing similar "predicting" of the ParserOutput language to
create an empty preview placeholder for use by preview.js. Now that
ApiParse (via ParserOutput::getText) returns a usable element without
any secret "you magically know the right class, lang, and dir" contract,
this placeholder is no longer needed.

Test Plan:

* EditPage: Default preview
  1. index.php?title=Main_Page&action=edit
  2. Show preview
  3. Assert <div class="mw-content-ltr mw-parser-output" lang=en dir=ltr>

* EditPage: JS preview
  1. Preferences > Editing > Show preview without reload
  2. index.php?title=Main_Page&action=edit
  3. Show preview
  4. Assert <div class="mw-content-ltr mw-parser-output" lang=en dir=ltr>
  5. Type something and 'Show preview' again
  6. Assert old element gone, new text is shown, and new element
     attributes are the same as the above.

== McrUndoAction ==

Same as EditPage basically, but without the JS preview use case.

== DifferenceEngine ==

Test:

1. Open /w/index.php?title=Main_Page&diff=0
   (this shows the latest diff, can do manually by viewing
   /wiki/Main_Page, click "View history", click "Compare selected revisions")
2. Assert <div class="mw-content-ltr mw-parser-output" lang=en dir=ltr>
3. Open /w/index.php?title=Main_Page&diff=0&action=render
4. Assert <div class="mw-content-ltr mw-parser-output" lang=en dir=ltr>

== Special:ExpandTemplates ==

Test:

1. /wiki/Special:ExpandTemplates
2. Write "Hello".
3. "OK"
4. Assert <div class="mw-content-ltr mw-parser-output" lang=en dir=ltr>

Bug: T341244
Depends-On: Icd9c079f5896ee83d86b9c2699636dc81d25a14c
Depends-On: I4e7484b3b94f1cb6062e7cef9f20626b650bb4b1
Depends-On: I90b88f3b3a3bbeba4f48d118f92f54864997e105
Change-Id: Ib130a055e46764544af0f1a46d2bc2b3a7ee85b7
2023-11-03 19:24:47 -04:00
..
actions Bump codesniffer to 42.0.0 2023-09-27 15:06:32 -04:00
api parser: Move lang/dir and mw-content-ltr to ParserOutput::getText 2023-11-03 19:24:47 -04:00
auth Introduce StatusFormatter 2023-10-27 14:56:51 +02:00
block Migrate callers of deprecated method BlockManager::getUserBlock() 2023-10-27 17:42:29 +00:00
cache Bump codesniffer to 42.0.0 2023-09-27 15:06:32 -04:00
Category Hard-deprecate ParserOutput::getCategories(), deprecated in 1.40 2023-09-29 15:25:50 -04:00
changes Drop RecentChange::getPerformer(), deprecated since 1.36 2023-09-27 22:41:21 +00:00
changetags tests: Use $this->getDb() instead of wfGetDB() in integration tests 2023-09-25 21:08:09 +02:00
collation
CommentStore tests: Migrate more cases to SQB 2023-09-21 18:30:37 +00:00
composer tests: Move test cases from /includes/ into sub folder 2023-09-13 00:09:05 +02:00
config Namespace Config-related classes under \MediaWiki\Config 2023-09-21 05:41:58 +00:00
content parser: Move lang/dir and mw-content-ltr to ParserOutput::getText 2023-11-03 19:24:47 -04:00
db rdbms: Introduce concept of virtual domains and mapping to ext cluster 2023-10-05 13:31:15 +02:00
debug MWDebug: Add support for native PHP warnings to "Console" 2023-10-19 17:13:12 -07:00
deferred Autofix spacing around commas 2023-10-25 01:08:44 +02:00
diff parser: Move lang/dir and mw-content-ltr to ParserOutput::getText 2023-11-03 19:24:47 -04:00
editpage tests: Use $this->getDb() instead of wfGetDB() in integration tests 2023-09-25 21:08:09 +02:00
exception
export tests: Move test cases from /includes/ into sub folder 2023-09-13 00:09:05 +02:00
ExternalLinks Autofix spacing around commas 2023-10-25 01:08:44 +02:00
externalstore
filebackend Simplify/remove duplicate assertStatusOK and such 2023-10-19 20:04:36 +00:00
filerepo Simplify/remove duplicate assertStatusOK and such 2023-10-19 20:04:36 +00:00
GlobalFunctions Autofix spacing around commas 2023-10-25 01:08:44 +02:00
HookContainer
Html tests: Move test cases from /includes/ into sub folder 2023-09-13 00:09:05 +02:00
htmlform Namespace Config-related classes under \MediaWiki\Config 2023-09-21 05:41:58 +00:00
http http: MultiHttpClient supports TelemetryHeadersInterface 2023-09-12 18:05:17 +02:00
import Replace generic new Exception with more generic ones 2023-10-17 07:59:50 +00:00
installer
interwiki tests: Use $this->getDb() instead of wfGetDB() in integration tests 2023-09-25 21:08:09 +02:00
jobqueue Make ParsoidOutputAccess a wrapper over ParserOutputAccess 2023-10-13 15:03:03 -05:00
language Autofix spacing around commas 2023-10-25 01:08:44 +02:00
languages Autofix spacing around commas 2023-10-25 01:08:44 +02:00
libs Autofix spacing around commas 2023-10-25 01:08:44 +02:00
linkeddata
linker Use $this->getServiceContainer() in tests 2023-10-17 18:40:46 +00:00
logging Use IReadableDatabase over IDatabase in DatabaseLogEntry::newFromId 2023-10-11 00:25:45 +01:00
mail Namespace User under \MediaWiki\User 2023-09-19 19:18:16 +00:00
media Autofix spacing around commas 2023-10-25 01:08:44 +02:00
Message
Navigation
objectcache
Output parser: Move lang/dir and mw-content-ltr to ParserOutput::getText 2023-11-03 19:24:47 -04:00
page parser: Move lang/dir and mw-content-ltr to ParserOutput::getText 2023-11-03 19:24:47 -04:00
pager Switch to ICP in some easy cases 2023-09-26 21:05:16 +02:00
ParamValidator/TypeDef Use $this->getServiceContainer() in tests 2023-10-17 18:40:46 +00:00
parser parser: Move lang/dir and mw-content-ltr to ParserOutput::getText 2023-11-03 19:24:47 -04:00
ParserOutputTransform parser: Move lang/dir and mw-content-ltr to ParserOutput::getText 2023-11-03 19:24:47 -04:00
password Simplify/remove duplicate assertStatusOK and such 2023-10-19 20:04:36 +00:00
Permissions Introduce BlockMockTrait 2023-10-27 12:22:36 +00:00
poolcounter Make use of assertStatusGood/Error and such in tests 2023-10-04 17:16:00 +00:00
preferences Namespace Config-related classes under \MediaWiki\Config 2023-09-21 05:41:58 +00:00
profiler
rcfeed Namespace remaining 'specialpage' files under \MediaWiki\SpecialPage 2023-09-18 18:23:13 +01:00
registration Bump codesniffer to 42.0.0 2023-09-27 15:06:32 -04:00
Request tests: Move test cases from /includes/ into sub folder 2023-09-13 00:09:05 +02:00
ResourceLoader Autofix spacing around commas 2023-10-25 01:08:44 +02:00
Rest
Revision parser: Move lang/dir and mw-content-ltr to ParserOutput::getText 2023-11-03 19:24:47 -04:00
search search: prefer user typed form when re-ranking a redirect to the top 2023-10-25 10:59:52 +02:00
session tests: Use $this->getDb() instead of wfGetDB() in integration tests 2023-09-25 21:08:09 +02:00
shell
site
SiteStats Convert numerous DB queries to use QueryBuilders 2023-10-09 19:06:53 +02:00
skins Introduce BlockMockTrait 2023-10-27 12:22:36 +00:00
sparql
specialpage Mass migrate simple cases to use expression builder 2023-10-26 16:59:19 +00:00
specials Merge "Introduce StatusFormatter" 2023-10-31 21:43:48 +00:00
Status Introduce StatusFormatter 2023-10-27 14:56:51 +02:00
Storage Autofix spacing around commas 2023-10-25 01:08:44 +02:00
title parser: Move lang/dir and mw-content-ltr to ParserOutput::getText 2023-11-03 19:24:47 -04:00
upload
user Introduce StatusFormatter 2023-10-27 14:56:51 +02:00
utils Replace generic new Exception with more generic ones 2023-10-17 07:59:50 +00:00
watcheditem Bump codesniffer to 42.0.0 2023-09-27 15:06:32 -04:00
WikiMap tests: Move test cases from /includes/ into sub folder 2023-09-13 00:09:05 +02:00
xml tests: Move test cases from /includes/ into sub folder 2023-09-13 00:09:05 +02:00
AutoLoaderTest.php
HooksTest.php Bump codesniffer to 42.0.0 2023-09-27 15:06:32 -04:00
MediaWikiServicesTest.php Namespace Config-related classes under \MediaWiki\Config 2023-09-21 05:41:58 +00:00
MediaWikiTest.php Namespace remaining Title-related classes under \MediaWiki\Title 2023-09-19 05:21:23 +00:00
MockServiceWiring.php
SampleTest.php
TestUser.php Namespace User under \MediaWiki\User 2023-09-19 19:18:16 +00:00
TestUserRegistry.php Autofix spacing around commas 2023-10-25 01:08:44 +02:00