aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/content/JavaScriptContentHandlerIntegrationTest.php
Commit message (Collapse)AuthorAgeFilesLines
* Use Remex/HtmlHelper to implement Parser::replaceTableOfContentsC. Scott Ananian2025-01-091-3/+3
| | | | | | | | | | | | | | | | This is more robust and secure than the regular expression previously used to extract the <meta> tag. We also improve HtmlHelper slightly be adding the ability to replace an element with an 'outerHTML' string. Because our output is being run through Remex, there is a slightly larger degree of HTML normalization in the output than previously, which is visible in some small tweaks to test case outputs. Bug: T381617 Depends-On: I2712e0fa9272106e8cd686980f847ee7f6385b6f Change-Id: I4cb2f29cf890af90f295624c586d9e1eb1939b95
* tests: Use namespaced classesUmherirrender2024-10-211-1/+1
| | | | | | | | Changes to the use statements and some additions are done automatically via script This also updates @covers tag for the namespaced classes Change-Id: I859ba6d05018c99710b744e2becab432410d3bca
* content: Widen `@covers` tags in phpunit testsTimo Tijhof2024-07-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | https://gerrit.wikimedia.org/r/q/owner:Krinkle+is:merged+message:Widen > Given all called methods are de-facto and liberally claimed, and > that we keep the coverage limited to the subject class, it maintains > the spirit and intent by listing the class explicitly instead. > > PHPUnit offers a more precise tool when you need it (i.e. when testing > legacy monster/god classes), but for well-written code, the > class-wide tag is exactly what you want. > > We lose useful coverage and waste valuable time on keeping tags > accurate through refactors (or worse, forget to do so). > Tracking tiny per-method details wastes time in realizing (and > fixing) when people inevitably don't keep them in sync, and time > lost in finding uncovered code to write tests to realize it was > already covered but "not yet claimed". While at it, also fix PHPUnit warnings in CssContentHandlerIntegrationTest and JavaScriptContentHandlerIntegrationTest about not having any `@covers` annotations. Change-Id: I5afd9fe0bca0fa86cc096f6e5e79f2ba1cfbfa77
* Use canonical parser options when rendering JavaScript/CSS for side effectsC. Scott Ananian2022-07-281-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | In the JavaScript and CSS content handlers we render the page "as wikitext" solely to generate categories, toc, etc, and then throw that output away and replace the generated HTML. Simplify the code paths and the caching by using the canonical options which don't split by user language, etc. Three minor issues with the current patch, which can hopefully be addressed in follow ups: 1. WikiPage::makeParserOptionsFromTitleAndModel() has a very cumbersome name and arguably doesn't belong in WikiPage in the first place. T313455 already exists to find a better place for this/way to do this. 2. Title::isConversionTable() requires a downcast of the page reference to a full title object. This method also probably wants to live somewhere else. 3. It really would be nice to combine this more properly with ContentHandler::getParserOutputForIndexing(), but that method uses a ParserOutputAccess object which requires a PageRecord, and we don't have a PageRecord available in fillParserOutput(). Bug: T307691 Change-Id: I081105741b507ed49e19cb878550ba4293e09413
* Add *ContentHandlerIntegrationTestC. Scott Ananian2022-07-211-0/+47
These tests appear to have been present previously, but were inadvertently omitted from the refactor in fa5237eb48a3c755797f0dce878e14c6fa8d40ff. This patch just updates the tests to undo code rot and re-enables them. It contains some placeholders for T307691 tests as well, which will be enabled in a follow-up patch. Change-Id: I73d0ed406b3ca8f94b384b76d6e01a5ca1b58e12