wiki.techinc.nl/tests/phpunit/includes/parser
Brian Wolff bec8dada48 Clarify generate-html and make ParserOutput behave as expected
Previously:
* It was unclear that generate-html is an optional optimization
* Most of MediaWiki core was doing $parserOutput->setText('') if
html wasn't generated. However this is wrong and will cause
$parserOutput->hasText() to return true and also potentially cause
cache pollution if a content handler both does that and supports
parser cache (Like MassMessage; see T299896)
* The default value of mText in the constructor was '', and most
of the time MW used that default. This doesn't seem right. If
setText() is never called, the ParserOutput should not be considered
to have text
* It was impossible to set mText to null, as $parserOutput->setText(null)
was a no-op. Docs implied you were supposed to do this, so it was very
confusing.

This patch clarifies docs, changes the default value for ParserOutput::$mText
from '' to null, and makes $parserOutput->setText(null) do what you
expect it to. The last two are arguably breaking changes, although
the previous behaviours were unexpected, mostly undocumented and
based on a code search do not appear to be relied on.

It seems like the main reason this only broke MassMessage is most
content handlers either don't support generateHtml, or they don't
support parser cache.

Bug: T306591
Change-Id: I49cdf21411c6b02ac9a221a13393bebe17c7871e
Depends-On: I68ad491735b2df13951399312a4f9c37b63a08fa
2022-05-03 11:23:08 +02:00
..
CacheTimeTest.php
CoreParserFunctionsTest.php phpunit: use ->getServiceContainer() in integration tests 2022-01-27 22:04:16 +01:00
LinkHolderArrayIntegrationTest.php
MagicVariableTest.php Emit warnings when accessing deprecated public properties of Parser 2022-03-31 19:25:33 -04:00
ParserCacheSerializationTestCases.php Clarify generate-html and make ParserOutput behave as expected 2022-05-03 11:23:08 +02:00
ParserCacheTest.php
ParserMethodsTest.php parser: change 'level' in parse api back to string 2022-03-18 19:52:24 +01:00
ParserOptionsTest.php Use new namespace for revision related classes 2022-04-09 20:22:36 +02:00
ParserOutputTest.php Clarify generate-html and make ParserOutput behave as expected 2022-05-03 11:23:08 +02:00
ParserPreloadTest.php phpunit: use ->getServiceContainer() in integration tests 2022-01-27 22:04:16 +01:00
ParserTest.php Use UrlUtils in Parser 2022-04-28 17:14:51 +03:00
PreprocessorTest.php phpcs: Disable Generic.Files.LineLength for test files 2022-02-18 18:32:05 +00:00
RevisionOutputCacheTest.php Use new namespace for revision related classes 2022-04-14 23:03:43 +02:00
SanitizerTest.php Hard deprecate Sanitizer::removeHTMLtags() 2022-03-07 22:04:56 -05:00
StripStateTest.php
TagHooksTest.php phpunit: use ->getServiceContainer() in integration tests 2022-01-27 22:04:16 +01:00
validateParserCacheSerializationTestData.php