Skip to content

Commit 75b3e15

Browse files
committed
Fixed static test failures
1 parent 3cc0a25 commit 75b3e15

File tree

2 files changed

+36
-11
lines changed

2 files changed

+36
-11
lines changed

dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Cache/_files/invalidCacheConfigXmlArray.php

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,47 +6,69 @@
66
return [
77
'without_type_handle' => [
88
'<?xml version="1.0"?><config></config>',
9-
["Element 'config': Missing child element(s). Expected is ( type ).\nLine: 1\n"],
9+
["Element 'config': Missing child element(s). Expected is ( type ).\n" .
10+
"Line: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n1:<config/>\n2:\n"],
1011
],
1112
'cache_config_with_notallowed_attribute' => [
1213
'<?xml version="1.0"?><config>' .
1314
'<type name="test" translate="label,description" instance="Class\Name" notallowed="some value">' .
1415
'<label>Test</label><description>Test</description></type></config>',
15-
["Element 'type', attribute 'notallowed': The attribute 'notallowed' is not allowed.\nLine: 1\n"],
16+
["Element 'type', attribute 'notallowed': The attribute 'notallowed' is not allowed.\nLine: 1\n" .
17+
"The xml was: \n0:<?xml version=\"1.0\"?>\n1:<config><type name=\"test\" translate=\"label,description\" " .
18+
"instance=\"Class\\Name\" notallowed=\"some value\"><label>Test</label><description>Test</description>" .
19+
"</type></config>\n2:\n"],
1620
],
1721
'cache_config_without_name_attribute' => [
1822
'<?xml version="1.0"?><config><type translate="label,description" instance="Class\Name">' .
1923
'<label>Test</label><description>Test</description></type></config>',
20-
["Element 'type': The attribute 'name' is required but missing.\nLine: 1\n"],
24+
["Element 'type': The attribute 'name' is required but missing.\n" .
25+
"Line: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n1:<config>" .
26+
"<type translate=\"label,description\" instance=\"Class\\Name\"><label>Test</label>" .
27+
"<description>Test</description></type></config>\n2:\n"],
2128
],
2229
'cache_config_without_instance_attribute' => [
2330
'<?xml version="1.0"?><config><type name="test" translate="label,description">' .
2431
'<label>Test</label><description>Test</description></type></config>',
25-
["Element 'type': The attribute 'instance' is required but missing.\nLine: 1\n"],
32+
["Element 'type': The attribute 'instance' is required but missing.\n" .
33+
"Line: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n1:<config>" .
34+
"<type name=\"test\" translate=\"label,description\"><label>Test</label><description>Test</description>" .
35+
"</type></config>\n2:\n"],
2636
],
2737
'cache_config_without_label_element' => [
2838
'<?xml version="1.0"?><config><type name="test" translate="label,description" instance="Class\Name">' .
2939
'<description>Test</description></type></config>',
30-
["Element 'type': Missing child element(s). Expected is ( label ).\nLine: 1\n"],
40+
["Element 'type': Missing child element(s). Expected is ( label ).\n" .
41+
"Line: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n" .
42+
"1:<config><type name=\"test\" translate=\"label,description\" instance=\"Class\\Name\">" .
43+
"<description>Test</description></type></config>\n2:\n"],
3144
],
3245
'cache_config_without_description_element' => [
3346
'<?xml version="1.0"?><config><type name="test" translate="label,description" instance="Class\Name">' .
3447
'<label>Test</label></type></config>',
35-
["Element 'type': Missing child element(s). Expected is ( description ).\nLine: 1\n"],
48+
["Element 'type': Missing child element(s). Expected is ( description ).\n" .
49+
"Line: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n" .
50+
"1:<config><type name=\"test\" translate=\"label,description\" instance=\"Class\\Name\">" .
51+
"<label>Test</label></type></config>\n2:\n"],
3652
],
3753
'cache_config_without_child_elements' => [
3854
'<?xml version="1.0"?><config><type name="test" translate="label,description" instance="Class\Name">' .
3955
'</type></config>',
40-
["Element 'type': Missing child element(s). Expected is one of ( label, description ).\nLine: 1\n"],
56+
["Element 'type': Missing child element(s). Expected is one of ( label, description ).\n" .
57+
"Line: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n" .
58+
"1:<config><type name=\"test\" translate=\"label,description\" instance=\"Class\\Name\"/></config>\n2:\n"],
4159
],
4260
'cache_config_cache_name_not_unique' => [
4361
'<?xml version="1.0"?><config><type name="test" translate="label,description" instance="Class\Name1">' .
4462
'<label>Test1</label><description>Test1</description></type>' .
4563
'<type name="test" translate="label,description" instance="Class\Name2">' .
4664
'<label>Test2</label><description>Test2</description></type></config>',
4765
[
48-
"Element 'type': Duplicate key-sequence ['test'] in unique identity-constraint"
49-
. " 'uniqueCacheName'.\nLine: 1\n"
66+
"Element 'type': Duplicate key-sequence ['test'] in unique identity-constraint 'uniqueCacheName'.\n" .
67+
"Line: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n" .
68+
"1:<config><type name=\"test\" translate=\"label,description\" instance=\"Class\\Name1\">" .
69+
"<label>Test1</label><description>Test1</description></type><type name=\"test\" " .
70+
"translate=\"label,description\" instance=\"Class\\Name2\">" .
71+
"<label>Test2</label><description>Test2</description></type></config>\n2:\n"
5072
],
5173
],
5274
];

lib/internal/Magento/Framework/Config/Dom.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,11 @@ public static function validateDomDocument(
403403
* @return string
404404
* @throws \InvalidArgumentException
405405
*/
406-
private static function _renderErrorMessage(\LibXMLError $errorInfo, string $format, \DOMDocument $dom = null): string
407-
{
406+
private static function _renderErrorMessage(
407+
\LibXMLError $errorInfo,
408+
string $format,
409+
\DOMDocument $dom = null
410+
): string {
408411
$result = $format;
409412
foreach ($errorInfo as $field => $value) {
410413
$placeholder = '%' . $field . '%';

0 commit comments

Comments
 (0)