Page MenuHomePhabricator

Remove ParserOutput::$mWarningMsgs workaround from ParserCacheSerializationTestCases
Open, Needs TriagePublic


Because MW before 1.38 didn't have ::addWarningMsg() (T293515), and then even after it was added (up until 1.41 or so) the actual message name and arguments weren't serialized (T343048), the "old" serialized ParserCache entries in tests/phpunit/data/ParserCache don't have any stored contents for ParserOutput::$mWarningMsgs, which means we need to work around this by clearing the warning msg array to make the post-deserialization equality test pass during SerializationTestTrait::testSerializationRoundTrip().


  1. after T343048 is resolved, a new test case should be added to ParserCacheSerializationTestCases::getParserOutputTestCases that duplicates the $parserOutputWithMetadata cases, but without clearing $mWarningMsgs. (See withMetadataPost1_31 and withMetadataPost1_34.) validateParserCacheSerializationTestData.php --create should be used to generate new serialization data in tests/phpunit/data/ParserCache starting with the version of MW in which T343048 is resolved.
  2. Once "the penultimate LTS version" (not the most recent LTS but the one before that) has the fix in T343048 and has test data in tests/phpunit/data/ParserCache', then the "old" $parserOutputWithMetadata test files in tests/phpunit/data/ParserCache/*-ParserOutput-withMetadata.{json,serialized}' can be removed and the $parserOutputWithMetadata code, including the $mWarningMsgs workaround, can be removed.