From 5b7a803a5d59db443c5a426b8c66b8413720d45d Mon Sep 17 00:00:00 2001 From: "C. Scott Ananian" Date: Mon, 23 Jun 2025 21:54:38 -0400 Subject: [PATCH] ParserCacheSerializationTestCases: back port ParserOutput changes from 1.45 Add parser cache data from 1.45, according to the process in https://www.mediawiki.org/wiki/Manual:Parser_cache/Serialization_compatibility and synchronizing with I04e715acc721d20c5fbd586ed44cef219f56cf4f. Change-Id: I55cdbf821f5d9930822a633a6b767f0528e74a5d --- .../1.45-CacheTime-cacheExpiry.json | 1 + .../1.45-CacheTime-cacheRevisionId.json | 1 + .../ParserCache/1.45-CacheTime-cacheTime.json | 1 + .../ParserCache/1.45-CacheTime-empty.json | 1 + .../1.45-CacheTime-usedOptions.json | 1 + ....45-ParserOutput-binaryPageProperties.json | 1 + .../1.45-ParserOutput-cacheTime.json | 1 + ...5-ParserOutput-codecableExtensionData.json | 1 + .../ParserCache/1.45-ParserOutput-empty.json | 1 + .../1.45-ParserOutput-extensionData.json | 1 + .../1.45-ParserOutput-pageProperties.json | 1 + .../ParserCache/1.45-ParserOutput-text.json | 1 + .../1.45-ParserOutput-usedOptions.json | 1 + ...1.45-ParserOutput-withFalsyProperties.json | 1 + .../1.45-ParserOutput-withMetadata.json | 1 + .../1.45-ParserOutput-withMetadata1_45.json | 1 + ....45-ParserOutput-withMetadataPost1_31.json | 1 + ....45-ParserOutput-withMetadataPost1_34.json | 1 + ....45-ParserOutput-withMetadataPost1_44.json | 1 + .../1.45-ParserOutput-withSections.json | 1 + ...5_with_messages-CacheTime-cacheExpiry.json | 1 + ...th_messages-CacheTime-cacheRevisionId.json | 1 + ....45_with_messages-CacheTime-cacheTime.json | 1 + .../1.45_with_messages-CacheTime-empty.json | 1 + ...5_with_messages-CacheTime-usedOptions.json | 1 + ...ges-ParserOutput-binaryPageProperties.json | 1 + ..._with_messages-ParserOutput-cacheTime.json | 1 + ...s-ParserOutput-codecableExtensionData.json | 1 + ...1.45_with_messages-ParserOutput-empty.json | 1 + ...h_messages-ParserOutput-extensionData.json | 1 + ...sages-ParserOutput-pageProperties1_45.json | 1 + .../1.45_with_messages-ParserOutput-text.json | 1 + ...ith_messages-ParserOutput-usedOptions.json | 1 + ...-ParserOutput-withFalsyProperties1_45.json | 1 + ...th_messages-ParserOutput-withMetadata.json | 1 + ...essages-ParserOutput-withMetadata1_45.json | 1 + ...ges-ParserOutput-withMetadataPost1_31.json | 1 + ...ges-ParserOutput-withMetadataPost1_34.json | 1 + ...ges-ParserOutput-withMetadataPost1_44.json | 1 + ...th_messages-ParserOutput-withSections.json | 1 + .../ParserCacheSerializationTestCases.php | 150 ++++++++++++++++++ 41 files changed, 190 insertions(+) create mode 100644 tests/phpunit/data/ParserCache/1.45-CacheTime-cacheExpiry.json create mode 100644 tests/phpunit/data/ParserCache/1.45-CacheTime-cacheRevisionId.json create mode 100644 tests/phpunit/data/ParserCache/1.45-CacheTime-cacheTime.json create mode 100644 tests/phpunit/data/ParserCache/1.45-CacheTime-empty.json create mode 100644 tests/phpunit/data/ParserCache/1.45-CacheTime-usedOptions.json create mode 100644 tests/phpunit/data/ParserCache/1.45-ParserOutput-binaryPageProperties.json create mode 100644 tests/phpunit/data/ParserCache/1.45-ParserOutput-cacheTime.json create mode 100644 tests/phpunit/data/ParserCache/1.45-ParserOutput-codecableExtensionData.json create mode 100644 tests/phpunit/data/ParserCache/1.45-ParserOutput-empty.json create mode 100644 tests/phpunit/data/ParserCache/1.45-ParserOutput-extensionData.json create mode 100644 tests/phpunit/data/ParserCache/1.45-ParserOutput-pageProperties.json create mode 100644 tests/phpunit/data/ParserCache/1.45-ParserOutput-text.json create mode 100644 tests/phpunit/data/ParserCache/1.45-ParserOutput-usedOptions.json create mode 100644 tests/phpunit/data/ParserCache/1.45-ParserOutput-withFalsyProperties.json create mode 100644 tests/phpunit/data/ParserCache/1.45-ParserOutput-withMetadata.json create mode 100644 tests/phpunit/data/ParserCache/1.45-ParserOutput-withMetadata1_45.json create mode 100644 tests/phpunit/data/ParserCache/1.45-ParserOutput-withMetadataPost1_31.json create mode 100644 tests/phpunit/data/ParserCache/1.45-ParserOutput-withMetadataPost1_34.json create mode 100644 tests/phpunit/data/ParserCache/1.45-ParserOutput-withMetadataPost1_44.json create mode 100644 tests/phpunit/data/ParserCache/1.45-ParserOutput-withSections.json create mode 100644 tests/phpunit/data/ParserCache/1.45_with_messages-CacheTime-cacheExpiry.json create mode 100644 tests/phpunit/data/ParserCache/1.45_with_messages-CacheTime-cacheRevisionId.json create mode 100644 tests/phpunit/data/ParserCache/1.45_with_messages-CacheTime-cacheTime.json create mode 100644 tests/phpunit/data/ParserCache/1.45_with_messages-CacheTime-empty.json create mode 100644 tests/phpunit/data/ParserCache/1.45_with_messages-CacheTime-usedOptions.json create mode 100644 tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-binaryPageProperties.json create mode 100644 tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-cacheTime.json create mode 100644 tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-codecableExtensionData.json create mode 100644 tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-empty.json create mode 100644 tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-extensionData.json create mode 100644 tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-pageProperties1_45.json create mode 100644 tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-text.json create mode 100644 tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-usedOptions.json create mode 100644 tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-withFalsyProperties1_45.json create mode 100644 tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-withMetadata.json create mode 100644 tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-withMetadata1_45.json create mode 100644 tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-withMetadataPost1_31.json create mode 100644 tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-withMetadataPost1_34.json create mode 100644 tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-withMetadataPost1_44.json create mode 100644 tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-withSections.json diff --git a/tests/phpunit/data/ParserCache/1.45-CacheTime-cacheExpiry.json b/tests/phpunit/data/ParserCache/1.45-CacheTime-cacheExpiry.json new file mode 100644 index 00000000000..fd58eeea0b7 --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45-CacheTime-cacheExpiry.json @@ -0,0 +1 @@ +{"ParseUsedOptions":[],"CacheExpiry":10,"CacheTime":"","CacheRevisionId":null,"_type_":"MediaWiki\\Parser\\CacheTime","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45-CacheTime-cacheRevisionId.json b/tests/phpunit/data/ParserCache/1.45-CacheTime-cacheRevisionId.json new file mode 100644 index 00000000000..caef44e80d2 --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45-CacheTime-cacheRevisionId.json @@ -0,0 +1 @@ +{"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":1234,"_type_":"MediaWiki\\Parser\\CacheTime","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45-CacheTime-cacheTime.json b/tests/phpunit/data/ParserCache/1.45-CacheTime-cacheTime.json new file mode 100644 index 00000000000..149669b69e9 --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45-CacheTime-cacheTime.json @@ -0,0 +1 @@ +{"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"20010419042521","CacheRevisionId":null,"_type_":"MediaWiki\\Parser\\CacheTime","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45-CacheTime-empty.json b/tests/phpunit/data/ParserCache/1.45-CacheTime-empty.json new file mode 100644 index 00000000000..4d0c168586a --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45-CacheTime-empty.json @@ -0,0 +1 @@ +{"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"_type_":"MediaWiki\\Parser\\CacheTime","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45-CacheTime-usedOptions.json b/tests/phpunit/data/ParserCache/1.45-CacheTime-usedOptions.json new file mode 100644 index 00000000000..7fdcdf04010 --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45-CacheTime-usedOptions.json @@ -0,0 +1 @@ +{"ParseUsedOptions":{"optA":true,"optX":true},"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"_type_":"MediaWiki\\Parser\\CacheTime","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45-ParserOutput-binaryPageProperties.json b/tests/phpunit/data/ParserCache/1.45-ParserOutput-binaryPageProperties.json new file mode 100644 index 00000000000..0e1a8a66a8d --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45-ParserOutput-binaryPageProperties.json @@ -0,0 +1 @@ +{"Text":"","LanguageLinks":[],"Categories":[],"Indicators":[],"TitleText":"","Links":[],"LinksSpecial":[],"Templates":[],"TemplateIds":[],"Images":[],"FileSearchOptions":[],"ExternalLinks":[],"InterwikiLinks":[],"ExistenceLinks":[],"NewSection":false,"HideNewSection":false,"NoGallery":false,"HeadItems":[],"Modules":[],"ModuleStyles":[],"JsConfigVars":[],"Warnings":[],"Sections":[],"Properties":{"empty":"","\\x00":"\u0000","gzip":{"_type_":"string","_encoding_":"base64","_data_":"H4sIAAAAAAAAA8tIzcnJVyjPLycKCQkJLiAnykkBAIURSg0LAAAA"}},"Timestamp":null,"EnableOOUI":false,"IndexPolicy":"","ExtensionData":[],"LimitReportData":[],"LimitReportJSData":[],"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":[],"ExtraDefaultSrcs":[],"ExtraStyleSrcs":[],"Flags":[],"SpeculativeRevId":null,"SpeculativePageIdUsed":null,"RevisionTimestampUsed":null,"RevisionUsedSha1Base36":null,"WrapperDivClasses":[],"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45-ParserOutput-cacheTime.json b/tests/phpunit/data/ParserCache/1.45-ParserOutput-cacheTime.json new file mode 100644 index 00000000000..1e68f05b824 --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45-ParserOutput-cacheTime.json @@ -0,0 +1 @@ +{"Text":"CacheTime","LanguageLinks":[],"Categories":[],"Indicators":[],"TitleText":"","Links":[],"LinksSpecial":[],"Templates":[],"TemplateIds":[],"Images":[],"FileSearchOptions":[],"ExternalLinks":[],"InterwikiLinks":[],"ExistenceLinks":[],"NewSection":false,"HideNewSection":false,"NoGallery":false,"HeadItems":[],"Modules":[],"ModuleStyles":[],"JsConfigVars":[],"Warnings":[],"Sections":[],"Properties":[],"Timestamp":null,"EnableOOUI":false,"IndexPolicy":"","ExtensionData":[],"LimitReportData":[],"LimitReportJSData":[],"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":[],"ExtraDefaultSrcs":[],"ExtraStyleSrcs":[],"Flags":[],"SpeculativeRevId":null,"SpeculativePageIdUsed":null,"RevisionTimestampUsed":null,"RevisionUsedSha1Base36":null,"WrapperDivClasses":[],"ParseUsedOptions":[],"CacheExpiry":10,"CacheTime":"20010419042521","CacheRevisionId":42,"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45-ParserOutput-codecableExtensionData.json b/tests/phpunit/data/ParserCache/1.45-ParserOutput-codecableExtensionData.json new file mode 100644 index 00000000000..c5c54227ee8 --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45-ParserOutput-codecableExtensionData.json @@ -0,0 +1 @@ +{"Text":"","LanguageLinks":[],"Categories":[],"Indicators":[],"TitleText":"","Links":[],"LinksSpecial":[],"Templates":[],"TemplateIds":[],"Images":[],"FileSearchOptions":[],"ExternalLinks":[],"InterwikiLinks":[],"ExistenceLinks":[],"NewSection":false,"HideNewSection":false,"NoGallery":false,"HeadItems":[],"Modules":[],"ModuleStyles":[],"JsConfigVars":[],"Warnings":[],"Sections":[],"Properties":[],"Timestamp":null,"EnableOOUI":false,"IndexPolicy":"","ExtensionData":{"map":{"a":{"super_class_field":"super","sub_class_field":"sub","_type_":"MediaWiki\\Tests\\Json\\JsonDeserializableSubClass","_complex_":true},"b":{"r":2,"d":"2","_type_":"stdClass","_complex_":true},"_complex_":true},"_complex_":true},"LimitReportData":[],"LimitReportJSData":[],"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":[],"ExtraDefaultSrcs":[],"ExtraStyleSrcs":[],"Flags":[],"SpeculativeRevId":null,"SpeculativePageIdUsed":null,"RevisionTimestampUsed":null,"RevisionUsedSha1Base36":null,"WrapperDivClasses":[],"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45-ParserOutput-empty.json b/tests/phpunit/data/ParserCache/1.45-ParserOutput-empty.json new file mode 100644 index 00000000000..750aa4ea248 --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45-ParserOutput-empty.json @@ -0,0 +1 @@ +{"Text":"","LanguageLinks":[],"Categories":[],"Indicators":[],"TitleText":"","Links":[],"LinksSpecial":[],"Templates":[],"TemplateIds":[],"Images":[],"FileSearchOptions":[],"ExternalLinks":[],"InterwikiLinks":[],"ExistenceLinks":[],"NewSection":false,"HideNewSection":false,"NoGallery":false,"HeadItems":[],"Modules":[],"ModuleStyles":[],"JsConfigVars":[],"Warnings":[],"Sections":[],"Properties":[],"Timestamp":null,"EnableOOUI":false,"IndexPolicy":"","ExtensionData":[],"LimitReportData":[],"LimitReportJSData":[],"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":[],"ExtraDefaultSrcs":[],"ExtraStyleSrcs":[],"Flags":[],"SpeculativeRevId":null,"SpeculativePageIdUsed":null,"RevisionTimestampUsed":null,"RevisionUsedSha1Base36":null,"WrapperDivClasses":[],"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45-ParserOutput-extensionData.json b/tests/phpunit/data/ParserCache/1.45-ParserOutput-extensionData.json new file mode 100644 index 00000000000..1ccf9c8f298 --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45-ParserOutput-extensionData.json @@ -0,0 +1 @@ +{"Text":"","LanguageLinks":[],"Categories":[],"Indicators":[],"TitleText":"","Links":[],"LinksSpecial":[],"Templates":[],"TemplateIds":[],"Images":[],"FileSearchOptions":[],"ExternalLinks":[],"InterwikiLinks":[],"ExistenceLinks":[],"NewSection":false,"HideNewSection":false,"NoGallery":false,"HeadItems":[],"Modules":[],"ModuleStyles":[],"JsConfigVars":[],"Warnings":[],"Sections":[],"Properties":[],"Timestamp":null,"EnableOOUI":false,"IndexPolicy":"","ExtensionData":{"boolean":true,"number":42,"string":"string","array":[1,2,3],"map":{"key":"value"}},"LimitReportData":[],"LimitReportJSData":[],"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":[],"ExtraDefaultSrcs":[],"ExtraStyleSrcs":[],"Flags":[],"SpeculativeRevId":null,"SpeculativePageIdUsed":null,"RevisionTimestampUsed":null,"RevisionUsedSha1Base36":null,"WrapperDivClasses":[],"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45-ParserOutput-pageProperties.json b/tests/phpunit/data/ParserCache/1.45-ParserOutput-pageProperties.json new file mode 100644 index 00000000000..1eb6a0c7c73 --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45-ParserOutput-pageProperties.json @@ -0,0 +1 @@ +{"Text":"","LanguageLinks":[],"Categories":[],"Indicators":[],"TitleText":"","Links":[],"LinksSpecial":[],"Templates":[],"TemplateIds":[],"Images":[],"FileSearchOptions":[],"ExternalLinks":[],"InterwikiLinks":[],"ExistenceLinks":[],"NewSection":false,"HideNewSection":false,"NoGallery":false,"HeadItems":[],"Modules":[],"ModuleStyles":[],"JsConfigVars":[],"Warnings":[],"Sections":[],"Properties":{"boolean":true,"null":null,"number":42,"string":"string","array":[1,2,3],"map":{"key":"value"}},"Timestamp":null,"EnableOOUI":false,"IndexPolicy":"","ExtensionData":[],"LimitReportData":[],"LimitReportJSData":[],"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":[],"ExtraDefaultSrcs":[],"ExtraStyleSrcs":[],"Flags":[],"SpeculativeRevId":null,"SpeculativePageIdUsed":null,"RevisionTimestampUsed":null,"RevisionUsedSha1Base36":null,"WrapperDivClasses":[],"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45-ParserOutput-text.json b/tests/phpunit/data/ParserCache/1.45-ParserOutput-text.json new file mode 100644 index 00000000000..4b43ff96c3e --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45-ParserOutput-text.json @@ -0,0 +1 @@ +{"Text":"Lorem Ipsum","LanguageLinks":[],"Categories":[],"Indicators":[],"TitleText":"","Links":[],"LinksSpecial":[],"Templates":[],"TemplateIds":[],"Images":[],"FileSearchOptions":[],"ExternalLinks":[],"InterwikiLinks":[],"ExistenceLinks":[],"NewSection":false,"HideNewSection":false,"NoGallery":false,"HeadItems":[],"Modules":[],"ModuleStyles":[],"JsConfigVars":[],"Warnings":[],"Sections":[],"Properties":[],"Timestamp":null,"EnableOOUI":false,"IndexPolicy":"","ExtensionData":[],"LimitReportData":[],"LimitReportJSData":[],"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":[],"ExtraDefaultSrcs":[],"ExtraStyleSrcs":[],"Flags":[],"SpeculativeRevId":null,"SpeculativePageIdUsed":null,"RevisionTimestampUsed":null,"RevisionUsedSha1Base36":null,"WrapperDivClasses":[],"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45-ParserOutput-usedOptions.json b/tests/phpunit/data/ParserCache/1.45-ParserOutput-usedOptions.json new file mode 100644 index 00000000000..d108033bbce --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45-ParserOutput-usedOptions.json @@ -0,0 +1 @@ +{"Text":"Dummy","LanguageLinks":[],"Categories":[],"Indicators":[],"TitleText":"","Links":[],"LinksSpecial":[],"Templates":[],"TemplateIds":[],"Images":[],"FileSearchOptions":[],"ExternalLinks":[],"InterwikiLinks":[],"ExistenceLinks":[],"NewSection":false,"HideNewSection":false,"NoGallery":false,"HeadItems":[],"Modules":[],"ModuleStyles":[],"JsConfigVars":[],"Warnings":[],"Sections":[],"Properties":[],"Timestamp":null,"EnableOOUI":false,"IndexPolicy":"","ExtensionData":[],"LimitReportData":[],"LimitReportJSData":[],"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":[],"ExtraDefaultSrcs":[],"ExtraStyleSrcs":[],"Flags":[],"SpeculativeRevId":null,"SpeculativePageIdUsed":null,"RevisionTimestampUsed":null,"RevisionUsedSha1Base36":null,"WrapperDivClasses":[],"ParseUsedOptions":{"optA":true,"optX":true},"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45-ParserOutput-withFalsyProperties.json b/tests/phpunit/data/ParserCache/1.45-ParserOutput-withFalsyProperties.json new file mode 100644 index 00000000000..10af905042f --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45-ParserOutput-withFalsyProperties.json @@ -0,0 +1 @@ +{"Text":"","LanguageLinks":[],"Categories":[],"Indicators":[],"TitleText":"","Links":[],"LinksSpecial":[],"Templates":[],"TemplateIds":[],"Images":[],"FileSearchOptions":[],"ExternalLinks":[],"InterwikiLinks":[],"ExistenceLinks":[],"NewSection":false,"HideNewSection":false,"NoGallery":false,"HeadItems":[],"Modules":[],"ModuleStyles":[],"JsConfigVars":[],"Warnings":[],"Sections":[],"Properties":{"boolean":false,"null":null,"number":0,"string":"","numstring":"0","array":[]},"Timestamp":null,"EnableOOUI":false,"IndexPolicy":"","ExtensionData":[],"LimitReportData":[],"LimitReportJSData":[],"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":[],"ExtraDefaultSrcs":[],"ExtraStyleSrcs":[],"Flags":[],"SpeculativeRevId":null,"SpeculativePageIdUsed":null,"RevisionTimestampUsed":null,"RevisionUsedSha1Base36":null,"WrapperDivClasses":[],"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45-ParserOutput-withMetadata.json b/tests/phpunit/data/ParserCache/1.45-ParserOutput-withMetadata.json new file mode 100644 index 00000000000..0123fb807ad --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45-ParserOutput-withMetadata.json @@ -0,0 +1 @@ +{"Text":"","LanguageLinks":["link1","link2"],"Categories":{"category2":"1","category1":"2"},"Indicators":{"indicator1":"indicator1_value"},"TitleText":"title_text1","Links":{"0":{"Link1":42},"2":{"Link2":43}},"LinksSpecial":[],"Templates":{"10":{"Template1":42}},"TemplateIds":{"10":{"Template1":4242}},"Images":{"Image1":1},"FileSearchOptions":{"Image1":{"time":"19731129213309","sha1":"test_sha1"}},"ExternalLinks":{"https://test.org":1},"InterwikiLinks":{"enwiki":{"interwiki1":1,"interwiki2":1}},"ExistenceLinks":[],"NewSection":true,"HideNewSection":true,"NoGallery":false,"HeadItems":{"tag1":"head_item1"},"Modules":["module1"],"ModuleStyles":["module_style1"],"JsConfigVars":{"key1":"value1"},"Warnings":{"warning1":1},"WarningMsgs":[],"Sections":[{"toclevel":0,"level":"1","line":"heading_1","number":"1.0","index":"T-1","fromtitle":false,"byteoffset":null,"anchor":"heading_1","linkAnchor":"#heading_1"},{"toclevel":1,"level":"2","line":"heading_2","number":"2.0","index":"T-2","fromtitle":false,"byteoffset":null,"anchor":"heading_2","linkAnchor":"#heading_2"}],"Properties":[],"Timestamp":"20010419042521","EnableOOUI":true,"IndexPolicy":"noindex","ExtensionData":[],"LimitReportData":{"limit_report_key1":"value1"},"LimitReportJSData":{"limit_report_key1":"value1"},"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":[],"ExtraDefaultSrcs":[],"ExtraStyleSrcs":[],"Flags":{"test":true,"mw:toc-set":true},"SpeculativeRevId":42,"SpeculativePageIdUsed":null,"RevisionTimestampUsed":null,"RevisionUsedSha1Base36":null,"WrapperDivClasses":[],"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"TOCExtensionData":[],"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} diff --git a/tests/phpunit/data/ParserCache/1.45-ParserOutput-withMetadata1_45.json b/tests/phpunit/data/ParserCache/1.45-ParserOutput-withMetadata1_45.json new file mode 100644 index 00000000000..4257b3d744d --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45-ParserOutput-withMetadata1_45.json @@ -0,0 +1 @@ +{"Text":"","LanguageLinks":["m:link1","mw:link2"],"Categories":{"category2":"1","category1":"2"},"Indicators":{"indicator1":"indicator1_value"},"TitleText":"title_text1","Links":{"0":{"Link1":42},"2":{"Link2":43}},"LinksSpecial":[],"Templates":{"10":{"Template1":42}},"TemplateIds":{"10":{"Template1":4242}},"Images":{"Image1":1},"FileSearchOptions":{"Image1":{"time":"19731129213309","sha1":"test_sha1"}},"ExternalLinks":{"https://test.org":1},"InterwikiLinks":{"enwiki":{"interwiki1":1,"interwiki2":1}},"ExistenceLinks":[],"NewSection":true,"HideNewSection":true,"NoGallery":false,"HeadItems":{"tag1":"head_item1"},"Modules":["module1"],"ModuleStyles":["module_style1"],"JsConfigVars":{"key1":"value1"},"Warnings":{"warning1":1},"WarningMsgs":[],"Sections":[{"toclevel":0,"level":"1","line":"heading_1","number":"1.0","index":"T-1","fromtitle":false,"byteoffset":null,"anchor":"heading_1","linkAnchor":"#heading_1"},{"toclevel":1,"level":"2","line":"heading_2","number":"2.0","index":"T-2","fromtitle":false,"byteoffset":null,"anchor":"heading_2","linkAnchor":"#heading_2"}],"Properties":[],"Timestamp":"20010419042521","EnableOOUI":true,"IndexPolicy":"noindex","ExtensionData":[],"LimitReportData":{"limit_report_key1":"value1"},"LimitReportJSData":{"limit_report_key1":"value1"},"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":[],"ExtraDefaultSrcs":[],"ExtraStyleSrcs":[],"Flags":{"test":true,"mw:toc-set":true},"SpeculativeRevId":42,"SpeculativePageIdUsed":null,"RevisionTimestampUsed":null,"RevisionUsedSha1Base36":null,"WrapperDivClasses":[],"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"TOCExtensionData":[],"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45-ParserOutput-withMetadataPost1_31.json b/tests/phpunit/data/ParserCache/1.45-ParserOutput-withMetadataPost1_31.json new file mode 100644 index 00000000000..ea2d066185c --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45-ParserOutput-withMetadataPost1_31.json @@ -0,0 +1 @@ +{"Text":"","LanguageLinks":[],"Categories":[],"Indicators":[],"TitleText":"","Links":[],"LinksSpecial":[],"Templates":[],"TemplateIds":[],"Images":[],"FileSearchOptions":[],"ExternalLinks":[],"InterwikiLinks":[],"ExistenceLinks":[],"NewSection":false,"HideNewSection":false,"NoGallery":true,"HeadItems":[],"Modules":[],"ModuleStyles":[],"JsConfigVars":[],"Warnings":[],"Sections":[],"Properties":[],"Timestamp":null,"EnableOOUI":false,"IndexPolicy":"","ExtensionData":[],"LimitReportData":[],"LimitReportJSData":[],"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":[],"ExtraDefaultSrcs":[],"ExtraStyleSrcs":[],"Flags":[],"SpeculativeRevId":null,"SpeculativePageIdUsed":4242,"RevisionTimestampUsed":"19731129213309","RevisionUsedSha1Base36":"test_hash","WrapperDivClasses":{"test_wrapper":true},"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45-ParserOutput-withMetadataPost1_34.json b/tests/phpunit/data/ParserCache/1.45-ParserOutput-withMetadataPost1_34.json new file mode 100644 index 00000000000..28790c0e8fa --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45-ParserOutput-withMetadataPost1_34.json @@ -0,0 +1 @@ +{"Text":"","LanguageLinks":[],"Categories":[],"Indicators":[],"TitleText":"","Links":[],"LinksSpecial":{"Link3":1},"Templates":[],"TemplateIds":[],"Images":[],"FileSearchOptions":[],"ExternalLinks":[],"InterwikiLinks":[],"ExistenceLinks":[],"NewSection":false,"HideNewSection":false,"NoGallery":false,"HeadItems":[],"Modules":[],"ModuleStyles":[],"JsConfigVars":[],"Warnings":[],"Sections":[],"Properties":[],"Timestamp":null,"EnableOOUI":false,"IndexPolicy":"","ExtensionData":[],"LimitReportData":[],"LimitReportJSData":[],"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":["script1"],"ExtraDefaultSrcs":["default1"],"ExtraStyleSrcs":["style1"],"Flags":[],"SpeculativeRevId":null,"SpeculativePageIdUsed":null,"RevisionTimestampUsed":null,"RevisionUsedSha1Base36":null,"WrapperDivClasses":[],"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45-ParserOutput-withMetadataPost1_44.json b/tests/phpunit/data/ParserCache/1.45-ParserOutput-withMetadataPost1_44.json new file mode 100644 index 00000000000..623a5c998c4 --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45-ParserOutput-withMetadataPost1_44.json @@ -0,0 +1 @@ +{"Text":"","LanguageLinks":["m:link1","mw:link2"],"Categories":{"category2":"1","category1":"2"},"Indicators":{"indicator1":"indicator1_value"},"TitleText":"title_text1","Links":{"0":{"Link1":42},"2":{"Link2":43}},"LinksSpecial":[],"Templates":{"10":{"Template1":42}},"TemplateIds":{"10":{"Template1":4242}},"Images":{"Image1":1},"FileSearchOptions":{"Image1":{"time":"19731129213309","sha1":"test_sha1"}},"ExternalLinks":{"https://test.org":1},"InterwikiLinks":{"enwiki":{"interwiki1":1,"interwiki2":1}},"ExistenceLinks":[],"NewSection":true,"HideNewSection":true,"NoGallery":false,"HeadItems":{"tag1":"head_item1"},"Modules":["module1"],"ModuleStyles":["module_style1"],"JsConfigVars":{"key1":"value1"},"Warnings":{"warning1":1},"WarningMsgs":{"rawmessage":{"key":"rawmessage","params":{"0":{"text":"warning1","_type_":"Wikimedia\\Message\\ScalarParam","_complex_":true},"_complex_":true},"_type_":"Wikimedia\\Message\\MessageValue","_complex_":true},"_complex_":true},"Sections":[{"toclevel":0,"level":"1","line":"heading_1","number":"1.0","index":"T-1","fromtitle":false,"byteoffset":null,"anchor":"heading_1","linkAnchor":"#heading_1"},{"toclevel":1,"level":"2","line":"heading_2","number":"2.0","index":"T-2","fromtitle":false,"byteoffset":null,"anchor":"heading_2","linkAnchor":"#heading_2"}],"Properties":[],"Timestamp":"20010419042521","EnableOOUI":true,"IndexPolicy":"noindex","ExtensionData":[],"LimitReportData":{"limit_report_key1":"value1"},"LimitReportJSData":{"limit_report_key1":"value1"},"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":[],"ExtraDefaultSrcs":[],"ExtraStyleSrcs":[],"Flags":{"test":true,"mw:toc-set":true},"SpeculativeRevId":42,"SpeculativePageIdUsed":null,"RevisionTimestampUsed":null,"RevisionUsedSha1Base36":null,"WrapperDivClasses":[],"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"TOCExtensionData":[],"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45-ParserOutput-withSections.json b/tests/phpunit/data/ParserCache/1.45-ParserOutput-withSections.json new file mode 100644 index 00000000000..bba08626457 --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45-ParserOutput-withSections.json @@ -0,0 +1 @@ +{"Text":"","LanguageLinks":[],"Categories":[],"Indicators":[],"TitleText":"","Links":[],"LinksSpecial":[],"Templates":[],"TemplateIds":[],"Images":[],"FileSearchOptions":[],"ExternalLinks":[],"InterwikiLinks":[],"ExistenceLinks":[],"NewSection":false,"HideNewSection":false,"NoGallery":false,"HeadItems":[],"Modules":[],"ModuleStyles":[],"JsConfigVars":[],"Warnings":[],"Sections":[{"toclevel":0,"level":"1","line":"heading_1","number":"1.0","index":"T-1","fromtitle":false,"byteoffset":null,"anchor":"heading_1","linkAnchor":"#heading_1"},{"toclevel":1,"level":"2","line":"heading_2","number":"2.0","index":"T-2","fromtitle":false,"byteoffset":null,"anchor":"heading_2","linkAnchor":"#heading_2"}],"Properties":[],"Timestamp":null,"EnableOOUI":false,"IndexPolicy":"","ExtensionData":[],"LimitReportData":[],"LimitReportJSData":[],"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":[],"ExtraDefaultSrcs":[],"ExtraStyleSrcs":[],"Flags":{"mw:toc-set":true},"SpeculativeRevId":null,"SpeculativePageIdUsed":null,"RevisionTimestampUsed":null,"RevisionUsedSha1Base36":null,"WrapperDivClasses":[],"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"TOCExtensionData":[],"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45_with_messages-CacheTime-cacheExpiry.json b/tests/phpunit/data/ParserCache/1.45_with_messages-CacheTime-cacheExpiry.json new file mode 100644 index 00000000000..fd58eeea0b7 --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45_with_messages-CacheTime-cacheExpiry.json @@ -0,0 +1 @@ +{"ParseUsedOptions":[],"CacheExpiry":10,"CacheTime":"","CacheRevisionId":null,"_type_":"MediaWiki\\Parser\\CacheTime","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45_with_messages-CacheTime-cacheRevisionId.json b/tests/phpunit/data/ParserCache/1.45_with_messages-CacheTime-cacheRevisionId.json new file mode 100644 index 00000000000..caef44e80d2 --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45_with_messages-CacheTime-cacheRevisionId.json @@ -0,0 +1 @@ +{"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":1234,"_type_":"MediaWiki\\Parser\\CacheTime","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45_with_messages-CacheTime-cacheTime.json b/tests/phpunit/data/ParserCache/1.45_with_messages-CacheTime-cacheTime.json new file mode 100644 index 00000000000..149669b69e9 --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45_with_messages-CacheTime-cacheTime.json @@ -0,0 +1 @@ +{"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"20010419042521","CacheRevisionId":null,"_type_":"MediaWiki\\Parser\\CacheTime","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45_with_messages-CacheTime-empty.json b/tests/phpunit/data/ParserCache/1.45_with_messages-CacheTime-empty.json new file mode 100644 index 00000000000..4d0c168586a --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45_with_messages-CacheTime-empty.json @@ -0,0 +1 @@ +{"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"_type_":"MediaWiki\\Parser\\CacheTime","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45_with_messages-CacheTime-usedOptions.json b/tests/phpunit/data/ParserCache/1.45_with_messages-CacheTime-usedOptions.json new file mode 100644 index 00000000000..7fdcdf04010 --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45_with_messages-CacheTime-usedOptions.json @@ -0,0 +1 @@ +{"ParseUsedOptions":{"optA":true,"optX":true},"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"_type_":"MediaWiki\\Parser\\CacheTime","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-binaryPageProperties.json b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-binaryPageProperties.json new file mode 100644 index 00000000000..21c4271ced8 --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-binaryPageProperties.json @@ -0,0 +1 @@ +{"Text":"","LanguageLinks":[],"Categories":[],"Indicators":[],"TitleText":"","Links":[],"LinksSpecial":[],"Templates":[],"TemplateIds":[],"Images":[],"FileSearchOptions":[],"ExternalLinks":[],"InterwikiLinks":[],"ExistenceLinks":[],"NewSection":false,"HideNewSection":false,"NoGallery":false,"HeadItems":[],"Modules":[],"ModuleStyles":[],"JsConfigVars":[],"Warnings":[],"WarningMsgs":[],"Sections":[],"Properties":{"empty":"","\\x00":"\u0000","gzip":{"_type_":"string","_encoding_":"base64","_data_":"H4sIAAAAAAAAA8tIzcnJVyjPLycKCQkJLiAnykkBAIURSg0LAAAA"}},"Timestamp":null,"EnableOOUI":false,"IndexPolicy":"","ExtensionData":[],"LimitReportData":[],"LimitReportJSData":[],"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":[],"ExtraDefaultSrcs":[],"ExtraStyleSrcs":[],"Flags":[],"SpeculativeRevId":null,"SpeculativePageIdUsed":null,"RevisionTimestampUsed":null,"RevisionUsedSha1Base36":null,"WrapperDivClasses":[],"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-cacheTime.json b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-cacheTime.json new file mode 100644 index 00000000000..069254e8f26 --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-cacheTime.json @@ -0,0 +1 @@ +{"Text":"CacheTime","LanguageLinks":[],"Categories":[],"Indicators":[],"TitleText":"","Links":[],"LinksSpecial":[],"Templates":[],"TemplateIds":[],"Images":[],"FileSearchOptions":[],"ExternalLinks":[],"InterwikiLinks":[],"ExistenceLinks":[],"NewSection":false,"HideNewSection":false,"NoGallery":false,"HeadItems":[],"Modules":[],"ModuleStyles":[],"JsConfigVars":[],"Warnings":[],"WarningMsgs":[],"Sections":[],"Properties":[],"Timestamp":null,"EnableOOUI":false,"IndexPolicy":"","ExtensionData":[],"LimitReportData":[],"LimitReportJSData":[],"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":[],"ExtraDefaultSrcs":[],"ExtraStyleSrcs":[],"Flags":[],"SpeculativeRevId":null,"SpeculativePageIdUsed":null,"RevisionTimestampUsed":null,"RevisionUsedSha1Base36":null,"WrapperDivClasses":[],"ParseUsedOptions":[],"CacheExpiry":10,"CacheTime":"20010419042521","CacheRevisionId":42,"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-codecableExtensionData.json b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-codecableExtensionData.json new file mode 100644 index 00000000000..8b8ff96d291 --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-codecableExtensionData.json @@ -0,0 +1 @@ +{"Text":"","LanguageLinks":[],"Categories":[],"Indicators":[],"TitleText":"","Links":[],"LinksSpecial":[],"Templates":[],"TemplateIds":[],"Images":[],"FileSearchOptions":[],"ExternalLinks":[],"InterwikiLinks":[],"ExistenceLinks":[],"NewSection":false,"HideNewSection":false,"NoGallery":false,"HeadItems":[],"Modules":[],"ModuleStyles":[],"JsConfigVars":[],"Warnings":[],"WarningMsgs":[],"Sections":[],"Properties":[],"Timestamp":null,"EnableOOUI":false,"IndexPolicy":"","ExtensionData":{"map":{"a":{"super_class_field":"super","sub_class_field":"sub","_type_":"MediaWiki\\Tests\\Json\\JsonDeserializableSubClass","_complex_":true},"b":{"r":2,"d":"2","_type_":"stdClass","_complex_":true},"_complex_":true},"_complex_":true},"LimitReportData":[],"LimitReportJSData":[],"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":[],"ExtraDefaultSrcs":[],"ExtraStyleSrcs":[],"Flags":[],"SpeculativeRevId":null,"SpeculativePageIdUsed":null,"RevisionTimestampUsed":null,"RevisionUsedSha1Base36":null,"WrapperDivClasses":[],"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-empty.json b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-empty.json new file mode 100644 index 00000000000..501fbf9f99d --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-empty.json @@ -0,0 +1 @@ +{"Text":"","LanguageLinks":[],"Categories":[],"Indicators":[],"TitleText":"","Links":[],"LinksSpecial":[],"Templates":[],"TemplateIds":[],"Images":[],"FileSearchOptions":[],"ExternalLinks":[],"InterwikiLinks":[],"ExistenceLinks":[],"NewSection":false,"HideNewSection":false,"NoGallery":false,"HeadItems":[],"Modules":[],"ModuleStyles":[],"JsConfigVars":[],"Warnings":[],"WarningMsgs":[],"Sections":[],"Properties":[],"Timestamp":null,"EnableOOUI":false,"IndexPolicy":"","ExtensionData":[],"LimitReportData":[],"LimitReportJSData":[],"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":[],"ExtraDefaultSrcs":[],"ExtraStyleSrcs":[],"Flags":[],"SpeculativeRevId":null,"SpeculativePageIdUsed":null,"RevisionTimestampUsed":null,"RevisionUsedSha1Base36":null,"WrapperDivClasses":[],"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-extensionData.json b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-extensionData.json new file mode 100644 index 00000000000..5eda722cb01 --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-extensionData.json @@ -0,0 +1 @@ +{"Text":"","LanguageLinks":[],"Categories":[],"Indicators":[],"TitleText":"","Links":[],"LinksSpecial":[],"Templates":[],"TemplateIds":[],"Images":[],"FileSearchOptions":[],"ExternalLinks":[],"InterwikiLinks":[],"ExistenceLinks":[],"NewSection":false,"HideNewSection":false,"NoGallery":false,"HeadItems":[],"Modules":[],"ModuleStyles":[],"JsConfigVars":[],"Warnings":[],"WarningMsgs":[],"Sections":[],"Properties":[],"Timestamp":null,"EnableOOUI":false,"IndexPolicy":"","ExtensionData":{"boolean":true,"number":42,"string":"string","array":[1,2,3],"map":{"key":"value"}},"LimitReportData":[],"LimitReportJSData":[],"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":[],"ExtraDefaultSrcs":[],"ExtraStyleSrcs":[],"Flags":[],"SpeculativeRevId":null,"SpeculativePageIdUsed":null,"RevisionTimestampUsed":null,"RevisionUsedSha1Base36":null,"WrapperDivClasses":[],"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-pageProperties1_45.json b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-pageProperties1_45.json new file mode 100644 index 00000000000..f6aaca908a1 --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-pageProperties1_45.json @@ -0,0 +1 @@ +{"Text":"","LanguageLinks":[],"Categories":[],"Indicators":[],"TitleText":"","Links":[],"LinksSpecial":[],"Templates":[],"TemplateIds":[],"Images":[],"FileSearchOptions":[],"ExternalLinks":[],"InterwikiLinks":[],"ExistenceLinks":[],"NewSection":false,"HideNewSection":false,"NoGallery":false,"HeadItems":[],"Modules":[],"ModuleStyles":[],"JsConfigVars":[],"Warnings":[],"WarningMsgs":[],"Sections":[],"Properties":{"boolean":1,"null":"","number":42,"string":"string","array":"Array","map":"Array"},"Timestamp":null,"EnableOOUI":false,"IndexPolicy":"","ExtensionData":[],"LimitReportData":[],"LimitReportJSData":[],"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":[],"ExtraDefaultSrcs":[],"ExtraStyleSrcs":[],"Flags":[],"SpeculativeRevId":null,"SpeculativePageIdUsed":null,"RevisionTimestampUsed":null,"RevisionUsedSha1Base36":null,"WrapperDivClasses":[],"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-text.json b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-text.json new file mode 100644 index 00000000000..90fbf4e1349 --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-text.json @@ -0,0 +1 @@ +{"Text":"Lorem Ipsum","LanguageLinks":[],"Categories":[],"Indicators":[],"TitleText":"","Links":[],"LinksSpecial":[],"Templates":[],"TemplateIds":[],"Images":[],"FileSearchOptions":[],"ExternalLinks":[],"InterwikiLinks":[],"ExistenceLinks":[],"NewSection":false,"HideNewSection":false,"NoGallery":false,"HeadItems":[],"Modules":[],"ModuleStyles":[],"JsConfigVars":[],"Warnings":[],"WarningMsgs":[],"Sections":[],"Properties":[],"Timestamp":null,"EnableOOUI":false,"IndexPolicy":"","ExtensionData":[],"LimitReportData":[],"LimitReportJSData":[],"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":[],"ExtraDefaultSrcs":[],"ExtraStyleSrcs":[],"Flags":[],"SpeculativeRevId":null,"SpeculativePageIdUsed":null,"RevisionTimestampUsed":null,"RevisionUsedSha1Base36":null,"WrapperDivClasses":[],"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-usedOptions.json b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-usedOptions.json new file mode 100644 index 00000000000..9cc841ad228 --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-usedOptions.json @@ -0,0 +1 @@ +{"Text":"Dummy","LanguageLinks":[],"Categories":[],"Indicators":[],"TitleText":"","Links":[],"LinksSpecial":[],"Templates":[],"TemplateIds":[],"Images":[],"FileSearchOptions":[],"ExternalLinks":[],"InterwikiLinks":[],"ExistenceLinks":[],"NewSection":false,"HideNewSection":false,"NoGallery":false,"HeadItems":[],"Modules":[],"ModuleStyles":[],"JsConfigVars":[],"Warnings":[],"WarningMsgs":[],"Sections":[],"Properties":[],"Timestamp":null,"EnableOOUI":false,"IndexPolicy":"","ExtensionData":[],"LimitReportData":[],"LimitReportJSData":[],"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":[],"ExtraDefaultSrcs":[],"ExtraStyleSrcs":[],"Flags":[],"SpeculativeRevId":null,"SpeculativePageIdUsed":null,"RevisionTimestampUsed":null,"RevisionUsedSha1Base36":null,"WrapperDivClasses":[],"ParseUsedOptions":{"optA":true,"optX":true},"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-withFalsyProperties1_45.json b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-withFalsyProperties1_45.json new file mode 100644 index 00000000000..72158703721 --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-withFalsyProperties1_45.json @@ -0,0 +1 @@ +{"Text":"","LanguageLinks":[],"Categories":[],"Indicators":[],"TitleText":"","Links":[],"LinksSpecial":[],"Templates":[],"TemplateIds":[],"Images":[],"FileSearchOptions":[],"ExternalLinks":[],"InterwikiLinks":[],"ExistenceLinks":[],"NewSection":false,"HideNewSection":false,"NoGallery":false,"HeadItems":[],"Modules":[],"ModuleStyles":[],"JsConfigVars":[],"Warnings":[],"WarningMsgs":[],"Sections":[],"Properties":{"boolean":0,"null":"","number":0,"string":"","numstring":"0","array":"Array"},"Timestamp":null,"EnableOOUI":false,"IndexPolicy":"","ExtensionData":[],"LimitReportData":[],"LimitReportJSData":[],"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":[],"ExtraDefaultSrcs":[],"ExtraStyleSrcs":[],"Flags":[],"SpeculativeRevId":null,"SpeculativePageIdUsed":null,"RevisionTimestampUsed":null,"RevisionUsedSha1Base36":null,"WrapperDivClasses":[],"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-withMetadata.json b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-withMetadata.json new file mode 100644 index 00000000000..0123fb807ad --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-withMetadata.json @@ -0,0 +1 @@ +{"Text":"","LanguageLinks":["link1","link2"],"Categories":{"category2":"1","category1":"2"},"Indicators":{"indicator1":"indicator1_value"},"TitleText":"title_text1","Links":{"0":{"Link1":42},"2":{"Link2":43}},"LinksSpecial":[],"Templates":{"10":{"Template1":42}},"TemplateIds":{"10":{"Template1":4242}},"Images":{"Image1":1},"FileSearchOptions":{"Image1":{"time":"19731129213309","sha1":"test_sha1"}},"ExternalLinks":{"https://test.org":1},"InterwikiLinks":{"enwiki":{"interwiki1":1,"interwiki2":1}},"ExistenceLinks":[],"NewSection":true,"HideNewSection":true,"NoGallery":false,"HeadItems":{"tag1":"head_item1"},"Modules":["module1"],"ModuleStyles":["module_style1"],"JsConfigVars":{"key1":"value1"},"Warnings":{"warning1":1},"WarningMsgs":[],"Sections":[{"toclevel":0,"level":"1","line":"heading_1","number":"1.0","index":"T-1","fromtitle":false,"byteoffset":null,"anchor":"heading_1","linkAnchor":"#heading_1"},{"toclevel":1,"level":"2","line":"heading_2","number":"2.0","index":"T-2","fromtitle":false,"byteoffset":null,"anchor":"heading_2","linkAnchor":"#heading_2"}],"Properties":[],"Timestamp":"20010419042521","EnableOOUI":true,"IndexPolicy":"noindex","ExtensionData":[],"LimitReportData":{"limit_report_key1":"value1"},"LimitReportJSData":{"limit_report_key1":"value1"},"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":[],"ExtraDefaultSrcs":[],"ExtraStyleSrcs":[],"Flags":{"test":true,"mw:toc-set":true},"SpeculativeRevId":42,"SpeculativePageIdUsed":null,"RevisionTimestampUsed":null,"RevisionUsedSha1Base36":null,"WrapperDivClasses":[],"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"TOCExtensionData":[],"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} diff --git a/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-withMetadata1_45.json b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-withMetadata1_45.json new file mode 100644 index 00000000000..4257b3d744d --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-withMetadata1_45.json @@ -0,0 +1 @@ +{"Text":"","LanguageLinks":["m:link1","mw:link2"],"Categories":{"category2":"1","category1":"2"},"Indicators":{"indicator1":"indicator1_value"},"TitleText":"title_text1","Links":{"0":{"Link1":42},"2":{"Link2":43}},"LinksSpecial":[],"Templates":{"10":{"Template1":42}},"TemplateIds":{"10":{"Template1":4242}},"Images":{"Image1":1},"FileSearchOptions":{"Image1":{"time":"19731129213309","sha1":"test_sha1"}},"ExternalLinks":{"https://test.org":1},"InterwikiLinks":{"enwiki":{"interwiki1":1,"interwiki2":1}},"ExistenceLinks":[],"NewSection":true,"HideNewSection":true,"NoGallery":false,"HeadItems":{"tag1":"head_item1"},"Modules":["module1"],"ModuleStyles":["module_style1"],"JsConfigVars":{"key1":"value1"},"Warnings":{"warning1":1},"WarningMsgs":[],"Sections":[{"toclevel":0,"level":"1","line":"heading_1","number":"1.0","index":"T-1","fromtitle":false,"byteoffset":null,"anchor":"heading_1","linkAnchor":"#heading_1"},{"toclevel":1,"level":"2","line":"heading_2","number":"2.0","index":"T-2","fromtitle":false,"byteoffset":null,"anchor":"heading_2","linkAnchor":"#heading_2"}],"Properties":[],"Timestamp":"20010419042521","EnableOOUI":true,"IndexPolicy":"noindex","ExtensionData":[],"LimitReportData":{"limit_report_key1":"value1"},"LimitReportJSData":{"limit_report_key1":"value1"},"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":[],"ExtraDefaultSrcs":[],"ExtraStyleSrcs":[],"Flags":{"test":true,"mw:toc-set":true},"SpeculativeRevId":42,"SpeculativePageIdUsed":null,"RevisionTimestampUsed":null,"RevisionUsedSha1Base36":null,"WrapperDivClasses":[],"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"TOCExtensionData":[],"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-withMetadataPost1_31.json b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-withMetadataPost1_31.json new file mode 100644 index 00000000000..9938bb57d84 --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-withMetadataPost1_31.json @@ -0,0 +1 @@ +{"Text":"","LanguageLinks":[],"Categories":[],"Indicators":[],"TitleText":"","Links":[],"LinksSpecial":[],"Templates":[],"TemplateIds":[],"Images":[],"FileSearchOptions":[],"ExternalLinks":[],"InterwikiLinks":[],"ExistenceLinks":[],"NewSection":false,"HideNewSection":false,"NoGallery":true,"HeadItems":[],"Modules":[],"ModuleStyles":[],"JsConfigVars":[],"Warnings":[],"WarningMsgs":[],"Sections":[],"Properties":[],"Timestamp":null,"EnableOOUI":false,"IndexPolicy":"","ExtensionData":[],"LimitReportData":[],"LimitReportJSData":[],"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":[],"ExtraDefaultSrcs":[],"ExtraStyleSrcs":[],"Flags":[],"SpeculativeRevId":null,"SpeculativePageIdUsed":4242,"RevisionTimestampUsed":"19731129213309","RevisionUsedSha1Base36":"test_hash","WrapperDivClasses":{"test_wrapper":true},"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-withMetadataPost1_34.json b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-withMetadataPost1_34.json new file mode 100644 index 00000000000..1ba7911a90b --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-withMetadataPost1_34.json @@ -0,0 +1 @@ +{"Text":"","LanguageLinks":[],"Categories":[],"Indicators":[],"TitleText":"","Links":[],"LinksSpecial":{"Link3":1},"Templates":[],"TemplateIds":[],"Images":[],"FileSearchOptions":[],"ExternalLinks":[],"InterwikiLinks":[],"ExistenceLinks":[],"NewSection":false,"HideNewSection":false,"NoGallery":false,"HeadItems":[],"Modules":[],"ModuleStyles":[],"JsConfigVars":[],"Warnings":[],"WarningMsgs":[],"Sections":[],"Properties":[],"Timestamp":null,"EnableOOUI":false,"IndexPolicy":"","ExtensionData":[],"LimitReportData":[],"LimitReportJSData":[],"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":["script1"],"ExtraDefaultSrcs":["default1"],"ExtraStyleSrcs":["style1"],"Flags":[],"SpeculativeRevId":null,"SpeculativePageIdUsed":null,"RevisionTimestampUsed":null,"RevisionUsedSha1Base36":null,"WrapperDivClasses":[],"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-withMetadataPost1_44.json b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-withMetadataPost1_44.json new file mode 100644 index 00000000000..623a5c998c4 --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-withMetadataPost1_44.json @@ -0,0 +1 @@ +{"Text":"","LanguageLinks":["m:link1","mw:link2"],"Categories":{"category2":"1","category1":"2"},"Indicators":{"indicator1":"indicator1_value"},"TitleText":"title_text1","Links":{"0":{"Link1":42},"2":{"Link2":43}},"LinksSpecial":[],"Templates":{"10":{"Template1":42}},"TemplateIds":{"10":{"Template1":4242}},"Images":{"Image1":1},"FileSearchOptions":{"Image1":{"time":"19731129213309","sha1":"test_sha1"}},"ExternalLinks":{"https://test.org":1},"InterwikiLinks":{"enwiki":{"interwiki1":1,"interwiki2":1}},"ExistenceLinks":[],"NewSection":true,"HideNewSection":true,"NoGallery":false,"HeadItems":{"tag1":"head_item1"},"Modules":["module1"],"ModuleStyles":["module_style1"],"JsConfigVars":{"key1":"value1"},"Warnings":{"warning1":1},"WarningMsgs":{"rawmessage":{"key":"rawmessage","params":{"0":{"text":"warning1","_type_":"Wikimedia\\Message\\ScalarParam","_complex_":true},"_complex_":true},"_type_":"Wikimedia\\Message\\MessageValue","_complex_":true},"_complex_":true},"Sections":[{"toclevel":0,"level":"1","line":"heading_1","number":"1.0","index":"T-1","fromtitle":false,"byteoffset":null,"anchor":"heading_1","linkAnchor":"#heading_1"},{"toclevel":1,"level":"2","line":"heading_2","number":"2.0","index":"T-2","fromtitle":false,"byteoffset":null,"anchor":"heading_2","linkAnchor":"#heading_2"}],"Properties":[],"Timestamp":"20010419042521","EnableOOUI":true,"IndexPolicy":"noindex","ExtensionData":[],"LimitReportData":{"limit_report_key1":"value1"},"LimitReportJSData":{"limit_report_key1":"value1"},"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":[],"ExtraDefaultSrcs":[],"ExtraStyleSrcs":[],"Flags":{"test":true,"mw:toc-set":true},"SpeculativeRevId":42,"SpeculativePageIdUsed":null,"RevisionTimestampUsed":null,"RevisionUsedSha1Base36":null,"WrapperDivClasses":[],"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"TOCExtensionData":[],"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-withSections.json b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-withSections.json new file mode 100644 index 00000000000..b4f19bc43f1 --- /dev/null +++ b/tests/phpunit/data/ParserCache/1.45_with_messages-ParserOutput-withSections.json @@ -0,0 +1 @@ +{"Text":"","LanguageLinks":[],"Categories":[],"Indicators":[],"TitleText":"","Links":[],"LinksSpecial":[],"Templates":[],"TemplateIds":[],"Images":[],"FileSearchOptions":[],"ExternalLinks":[],"InterwikiLinks":[],"ExistenceLinks":[],"NewSection":false,"HideNewSection":false,"NoGallery":false,"HeadItems":[],"Modules":[],"ModuleStyles":[],"JsConfigVars":[],"Warnings":[],"WarningMsgs":[],"Sections":[{"toclevel":0,"level":"1","line":"heading_1","number":"1.0","index":"T-1","fromtitle":false,"byteoffset":null,"anchor":"heading_1","linkAnchor":"#heading_1"},{"toclevel":1,"level":"2","line":"heading_2","number":"2.0","index":"T-2","fromtitle":false,"byteoffset":null,"anchor":"heading_2","linkAnchor":"#heading_2"}],"Properties":[],"Timestamp":null,"EnableOOUI":false,"IndexPolicy":"","ExtensionData":[],"LimitReportData":[],"LimitReportJSData":[],"CacheMessage":"","TimeProfile":[],"ParseStartTime":[],"PreventClickjacking":false,"ExtraScriptSrcs":[],"ExtraDefaultSrcs":[],"ExtraStyleSrcs":[],"Flags":{"mw:toc-set":true},"SpeculativeRevId":null,"SpeculativePageIdUsed":null,"RevisionTimestampUsed":null,"RevisionUsedSha1Base36":null,"WrapperDivClasses":[],"ParseUsedOptions":[],"CacheExpiry":null,"CacheTime":"","CacheRevisionId":null,"TOCExtensionData":[],"_type_":"MediaWiki\\Parser\\ParserOutput","_complex_":true} \ No newline at end of file diff --git a/tests/phpunit/includes/parser/ParserCacheSerializationTestCases.php b/tests/phpunit/includes/parser/ParserCacheSerializationTestCases.php index 81674bc1c42..03fadefdaad 100644 --- a/tests/phpunit/includes/parser/ParserCacheSerializationTestCases.php +++ b/tests/phpunit/includes/parser/ParserCacheSerializationTestCases.php @@ -171,6 +171,43 @@ abstract class ParserCacheSerializationTestCases { ]; } + /** + * This matches PagePropsTable::encodeValue() and represents how + * page properties are actually stored in the database. + * @param mixed $v + * @return int|float|string + */ + public static function pagePropEncode( $v ) { + if ( is_int( $v ) || is_float( $v ) || is_string( $v ) ) { + return $v; + } + if ( is_bool( $v ) ) { + return (int)$v; + } + if ( $v === null ) { + return ''; + } + if ( is_array( $v ) ) { + // strval on an array yield 'Array' plus a warning. + return 'Array'; + } + return strval( $v ); + } + + /** + * Assert equality in terms of semantically equivalent page property + * values. + * @param MediaWikiIntegrationTestCase $testCase + * @param mixed $expected + * @param mixed $actual + */ + public static function assertPagePropSame( MediaWikiIntegrationTestCase $testCase, $expected, $actual ): void { + $testCase->assertSame( + self::pagePropEncode( $expected ), + $actual + ); + } + /** * Get acceptance test cases for ParserOutput class. * @see SerializationTestTrait::getTestInstancesAndAssertions() @@ -207,11 +244,23 @@ abstract class ParserCacheSerializationTestCases { $parserOutputWithProperties->setPageProperty( $key, $value ); } + $parserOutputWithProperties1_45 = new ParserOutput( '' ); + foreach ( self::MOCK_EXT_DATA as $key => $value ) { + $value = self::pagePropEncode( $value ); + $parserOutputWithProperties1_45->setPageProperty( $key, $value ); + } + $parserOutputWithFalsyProperties = new ParserOutput( '' ); foreach ( self::MOCK_FALSY_PROPERTIES as $key => $value ) { $parserOutputWithFalsyProperties->setPageProperty( $key, $value ); } + $parserOutputWithFalsyProperties1_45 = new ParserOutput( '' ); + foreach ( self::MOCK_FALSY_PROPERTIES as $key => $value ) { + $value = self::pagePropEncode( $value ); + $parserOutputWithFalsyProperties1_45->setPageProperty( $key, $value ); + } + $parserOutputWithBinaryProperties = new ParserOutput( '' ); foreach ( self::MOCK_BINARY_PROPERTIES as $key => $value ) { $parserOutputWithBinaryProperties->setPageProperty( $key, $value ); @@ -262,6 +311,9 @@ abstract class ParserCacheSerializationTestCases { $parserOutputWithMetadata )->mWarningMsgs = []; + $parserOutputWithMetadataPost1_44 = clone $parserOutputWithMetadata; + $parserOutputWithMetadataPost1_44->setLanguageLinks( [ 'm:link1', 'mw:link2' ] ); + $parserOutputWithSections = new ParserOutput( '' ); $parserOutputWithSections->setSections( self::SECTIONS ); @@ -406,6 +458,21 @@ abstract class ParserCacheSerializationTestCases { $testCase->assertArrayEquals( self::MOCK_EXT_DATA, $object->getPageProperties() ); } ], + 'pageProperties1_45' => [ + 'instance' => $parserOutputWithProperties1_45, + 'assertions' => static function ( MediaWikiIntegrationTestCase $testCase, ParserOutput $object ) { + self::assertPagePropSame( $testCase, self::MOCK_EXT_DATA['boolean'], $object->getPageProperty( 'boolean' ) ); + self::assertPagePropSame( $testCase, self::MOCK_EXT_DATA['null'], $object->getPageProperty( 'null' ) ); + self::assertPagePropSame( $testCase, self::MOCK_EXT_DATA['number'], $object->getPageProperty( 'number' ) ); + self::assertPagePropSame( $testCase, self::MOCK_EXT_DATA['string'], $object->getPageProperty( 'string' ) ); + self::assertPagePropSame( $testCase, self::MOCK_EXT_DATA['array'], $object->getPageProperty( 'array' ) ); + self::assertPagePropSame( $testCase, self::MOCK_EXT_DATA['map'], $object->getPageProperty( 'map' ) ); + $testCase->assertArrayEquals( + array_map( fn ( $v )=>self::pagePropEncode( $v ), self::MOCK_EXT_DATA ), + array_map( fn ( $v )=>self::pagePropEncode( $v ), $object->getPageProperties() ) + ); + } + ], 'binaryPageProperties' => [ 'instance' => $parserOutputWithBinaryProperties, 'assertions' => static function ( MediaWikiIntegrationTestCase $testCase, ParserOutput $object ) { @@ -469,6 +536,60 @@ abstract class ParserCacheSerializationTestCases { $testCase->assertArrayEquals( [ 'test' ], $object->getAllFlags() ); } ], + 'withMetadataPost1_44' => [ + 'instance' => $parserOutputWithMetadataPost1_44, + 'assertions' => static function ( MediaWikiIntegrationTestCase $testCase, ParserOutput $object ) { + $testCase->assertSame( 42, $object->getSpeculativeRevIdUsed() ); + $testCase->assertArrayEquals( [ 'm:link1', 'mw:link2' ], $object->getLanguageLinks() ); + $testCase->assertArrayEquals( [ 'enwiki' => [ + 'interwiki1' => 1, + 'interwiki2' => 1 + ] ], $object->getInterwikiLinks() ); + $testCase->assertArrayEquals( [ 'category1', 'category2' ], $object->getCategoryNames() ); + $testCase->assertArrayEquals( [ + 'category1' => '2', + 'category2' => '1' + ], $object->getCategoryMap() ); + $testCase->assertArrayEquals( [ 'indicator1' => 'indicator1_value' ], $object->getIndicators() ); + $testCase->assertSame( 'title_text1', $object->getTitleText() ); + $testCase->assertArrayEquals( self::SECTIONS, $object->getSections() ); + $testCase->assertArrayEquals( [ + NS_MAIN => [ 'Link1' => 42 ], + NS_USER => [ 'Link2' => 43 ] + ], $object->getLinks() ); + $testCase->assertArrayEquals( [ + NS_SPECIAL => [ 'Template1' => 42 ] + ], $object->getTemplates() ); + $testCase->assertArrayEquals( [ + NS_SPECIAL => [ 'Template1' => 4242 ] + ], $object->getTemplateIds() ); + $testCase->assertArrayEquals( [ 'Image1' => 1 ], $object->getImages() ); + $testCase->assertArrayEquals( [ 'Image1' => [ + 'time' => MWTimestamp::convert( TS_MW, 123456789 ), 'sha1' => 'test_sha1' + ] ], $object->getFileSearchOptions() ); + $testCase->assertArrayEquals( [ 'https://test.com' => 1 ], $object->getExternalLinks() ); + $testCase->assertArrayEquals( [ 'tag1' => 'head_item1' ], $object->getHeadItems() ); + $testCase->assertArrayEquals( [ 'module1' ], $object->getModules() ); + $testCase->assertArrayEquals( [ 'module_style1' ], $object->getModuleStyles() ); + $testCase->assertArrayEquals( [ 'key1' => 'value1' ], $object->getJsConfigVars() ); + $testCase->assertArrayEquals( [ 'warning1' ], $object->getWarnings() ); + $testCase->assertSame( 'noindex', $object->getIndexPolicy() ); + $testCase->assertSame( MWTimestamp::convert( TS_MW, 987654321 ), $object->getRevisionTimestamp() ); + $testCase->assertArrayEquals( + [ 'limit_report_key1' => 'value1' ], + $object->getLimitReportData() + ); + $testCase->assertArrayEquals( + [ 'limit_report_key1' => 'value1' ], + $object->getLimitReportJSData() + ); + $testCase->assertTrue( $object->getEnableOOUI() ); + $testCase->assertTrue( $object->getHideNewSection() ); + $testCase->assertTrue( $object->getNewSection() ); + $testCase->assertTrue( $object->getOutputFlag( 'test' ) ); + $testCase->assertArrayEquals( [ 'test' ], $object->getAllFlags() ); + } + ], 'withSections' => [ 'instance' => $parserOutputWithSections, 'assertions' => static function ( MediaWikiIntegrationTestCase $testCase, ParserOutput $object ) { @@ -526,6 +647,35 @@ abstract class ParserCacheSerializationTestCases { ); } ], + 'withFalsyProperties1_45' => [ + 'instance' => $parserOutputWithFalsyProperties1_45, + 'assertions' => static function ( MediaWikiIntegrationTestCase $testCase, ParserOutput $object ) { + self::assertPagePropSame( $testCase, + self::MOCK_FALSY_PROPERTIES['boolean'], + $object->getPageProperty( 'boolean' ) + ); + self::assertPagePropSame( $testCase, + self::MOCK_FALSY_PROPERTIES['null'], + $object->getPageProperty( 'null' ) + ); + self::assertPagePropSame( $testCase, + self::MOCK_FALSY_PROPERTIES['number'], + $object->getPageProperty( 'number' ) + ); + self::assertPagePropSame( $testCase, + self::MOCK_FALSY_PROPERTIES['string'], + $object->getPageProperty( 'string' ) + ); + self::assertPagePropSame( $testCase, + self::MOCK_FALSY_PROPERTIES['numstring'], + $object->getPageProperty( 'numstring' ) + ); + self::assertPagePropSame( $testCase, + self::MOCK_FALSY_PROPERTIES['array'], + $object->getPageProperty( 'array' ) + ); + } + ], ]; // We don't serialize or restore parseStartTime any more, so // ensure that it is cleared in the instances we are going to