Skip to content

Commit e53a91c

Browse files
committed
Fixed Unit test for Email and framework module
1 parent ed71097 commit e53a91c

File tree

11 files changed

+484
-157
lines changed

11 files changed

+484
-157
lines changed

app/code/Magento/Email/Test/Unit/Model/Template/Config/XsdTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function mergedXmlDataProvider()
7474
</config>',
7575
[
7676
"Element 'template': Character content is not allowed, because the content type is empty." .
77-
"The xml was:\n0:<?xml version=\"1.0\"?>\n1:<config>\n2: <template " .
77+
"The xml was: \n0:<?xml version=\"1.0\"?>\n1:<config>\n2: <template " .
7878
"id=\"test\" label=\"Test\" file=\"test.txt\" type=\"text\" module=\"Module\" " .
7979
"area=\"frontend\">invalid</template>\n3: </config>\n4:\n"
8080
],
@@ -142,10 +142,10 @@ public function mergedXmlDataProvider()
142142
'node "template" with invalid attribute "area"' => [
143143
'<config><template id="test" label="Test" file="test.txt" type="text" module="Module" area="invalid"/></config>',
144144
[
145-
"Element 'template', attribute 'type': [facet 'enumeration'] The value 'invalid' is not an " .
146-
"element of the set {'html', 'text'}.The xml was: \n0:<?xml version=\"1.0\"?>\n" .
147-
"1:<config><template id=\"test\" label=\"Test\" file=\"test.txt\" type=\"invalid\" " .
148-
"module=\"Module\" area=\"frontend\"/></config>\n2:\n",
145+
"Element 'template', attribute 'area': 'invalid' is not a valid value of the atomic type " .
146+
"'areaType'.The xml was: \n0:<?xml version=\"1.0\"?>\n1:<config><template id=\"test\" " .
147+
"label=\"Test\" file=\"test.txt\" type=\"text\" module=\"Module\" area=\"invalid\"/>" .
148+
"</config>\n2:\n",
149149
],
150150
],
151151
'node "template" with unknown attribute' => [

lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/Config/_files/invalidAclXmlArray.php

Lines changed: 82 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,135 +10,187 @@
1010
'<?xml version="1.0"?><config><acl><resources><resource id="Test_Value::show_toolbar" ' .
1111
'disabled=""/></resources></acl></config>',
1212
[
13-
"Element 'resource', attribute 'disabled': '' is not a valid value of the atomic" .
14-
" type 'xs:boolean'.\nLine: 1\n"],
13+
"Element 'resource', attribute 'disabled': '' is not a valid value of the atomic type " .
14+
"'xs:boolean'.\nLine: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n1:<config><acl><resources>" .
15+
"<resource id=\"Test_Value::show_toolbar\" disabled=\"\"/></resources></acl>" .
16+
"</config>\n2:\n"
17+
],
1518
],
1619
'disabled_attribute_wrong_type_value' => [
1720
'<?xml version="1.0"?><config><acl><resources><resource id="Test_Value::show_toolbar" ' .
1821
'disabled="notBool"/></resources></acl></config>',
1922
[
2023
"Element 'resource', attribute 'disabled': 'notBool' is not a valid value of the atomic type " .
21-
"'xs:boolean'.\nLine: 1\n"
24+
"'xs:boolean'.\nLine: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n1:<config><acl><resources>" .
25+
"<resource id=\"Test_Value::show_toolbar\" disabled=\"notBool\"/></resources>" .
26+
"</acl></config>\n2:\n"
2227
],
2328
],
2429
'double_acl' => [
2530
'<?xml version="1.0"?><config><acl><resources></resources></acl><acl/></config>',
26-
["Element 'acl': This element is not expected.\nLine: 1\n"],
31+
[
32+
"Element 'acl': This element is not expected.\nLine: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n" .
33+
"1:<config><acl><resources/></acl><acl/></config>\n2:\n"
34+
],
2735
],
2836
'double_resource' => [
2937
'<?xml version="1.0"?><config><acl><resources></resources><resources></resources></acl></config>',
30-
["Element 'resources': This element is not expected.\nLine: 1\n"],
38+
[
39+
"Element 'resources': This element is not expected.\nLine: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n" .
40+
"1:<config><acl><resources/><resources/></acl></config>\n2:\n"
41+
],
3142
],
3243
'less_minLength_title_attribute' => [
3344
'<?xml version="1.0"?><config><acl><resources><resource id="Test_Value::show_toolbar" ' .
3445
'title="Sh"/></resources></acl></config>',
3546
[
36-
"Element 'resource', attribute 'title': [facet 'minLength'] The value 'Sh' has a length of '2'; " .
37-
"this underruns the allowed minimum length of '3'.\nLine: 1\n"
47+
"Element 'resource', attribute 'title': [facet 'minLength'] The value 'Sh' has a length of '2'; this " .
48+
"underruns the allowed minimum length of '3'.\nLine: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n" .
49+
"1:<config><acl><resources><resource id=\"Test_Value::show_toolbar\" title=\"Sh\"/></resources>" .
50+
"</acl></config>\n2:\n"
3851
],
3952
],
4053
'more_maxLength_title_attribute' => [
4154
'<?xml version="1.0"?><config><acl><resources><resource id="Test_Value::show_toolbar"' .
4255
' title="Lorem ipsum dolor sit amet, consectetur adipisicing"/></resources></acl></config>',
4356
[
4457
"Element 'resource', attribute 'title': [facet 'maxLength'] The value 'Lorem ipsum dolor sit amet, " .
45-
"consectetur adipisicing' has a length of '51'; this exceeds the allowed maximum" .
46-
" length of '50'.\nLine: 1\n"
58+
"consectetur adipisicing' has a length of '51'; this exceeds the allowed maximum length of '50'.\n" .
59+
"Line: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n1:<config><acl><resources><resource " .
60+
"id=\"Test_Value::show_toolbar\" title=\"Lorem ipsum dolor sit amet, consectetur adipisicing\"/>" .
61+
"</resources></acl></config>\n2:\n"
4762
],
4863
],
4964
'notvalid_id_attribute_value_regexp1' => [
5065
'<?xml version="1.0"?><config><acl><resources><resource id="test_Value::show_toolbar"/>' .
5166
'</resources></acl></config>',
5267
[
53-
"Element 'resource', attribute 'id': [facet 'pattern'] The value 'test_Value::show_toolbar' is " .
54-
"not accepted by the pattern" .
55-
" '([A-Z]+[a-zA-Z0-9]{1,}){1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.\nLine: 1\n"
68+
"Element 'resource', attribute 'id': [facet 'pattern'] The value 'test_Value::show_toolbar' is not " .
69+
"accepted by the pattern '([A-Z]+[a-zA-Z0-9]{1,}){1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.\n" .
70+
"Line: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n1:<config><acl><resources><resource " .
71+
"id=\"test_Value::show_toolbar\"/></resources></acl></config>\n2:\n"
5672
],
5773
],
5874
'notvalid_id_attribute_value_regexp2' => [
5975
'<?xml version="1.0"?><config><acl><resources><resource id="Test_value::show_toolbar"/>' .
6076
'</resources></acl></config>',
6177
[
6278
"Element 'resource', attribute 'id': [facet 'pattern'] The value 'Test_value::show_toolbar' is not " .
63-
"accepted by the pattern '([A-Z]+[a-zA-Z0-9]{1,}){1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.\nLine: 1\n"
79+
"accepted by the pattern '([A-Z]+[a-zA-Z0-9]{1,}){1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.\n" .
80+
"Line: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n1:<config><acl><resources><resource " .
81+
"id=\"Test_value::show_toolbar\"/></resources></acl></config>\n2:\n"
6482
],
6583
],
6684
'notvalid_id_attribute_value_regexp3' => [
6785
'<?xml version="1.0"?><config><acl><resources><resource id="M@#$%^*_Value::show_toolbar"/>' .
6886
'</resources></acl></config>',
6987
[
7088
"Element 'resource', attribute 'id': [facet 'pattern'] The value 'M@#$%^*_Value::show_toolbar' is not " .
71-
"accepted by the pattern '([A-Z]+[a-zA-Z0-9]{1,}){1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.\nLine: 1\n"
89+
"accepted by the pattern '([A-Z]+[a-zA-Z0-9]{1,}){1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.\n" .
90+
"Line: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n1:<config><acl><resources><resource " .
91+
"id=\"M@#$%^*_Value::show_toolbar\"/></resources></acl></config>\n2:\n"
7292
],
7393
],
7494
'notvalid_id_attribute_value_regexp4' => [
7595
'<?xml version="1.0"?><config><acl><resources><resource id="_Value::show_toolbar"/>' .
7696
'</resources></acl></config>',
7797
[
7898
"Element 'resource', attribute 'id': [facet 'pattern'] The value '_Value::show_toolbar' is not " .
79-
"accepted by the pattern '([A-Z]+[a-zA-Z0-9]{1,}){1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.\nLine: 1\n"
99+
"accepted by the pattern '([A-Z]+[a-zA-Z0-9]{1,}){1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.\n" .
100+
"Line: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n1:<config><acl><resources><resource " .
101+
"id=\"_Value::show_toolbar\"/></resources></acl></config>\n2:\n"
80102
],
81103
],
82104
'notvalid_id_attribute_value_regexp5' => [
83105
'<?xml version="1.0"?><config><acl><resources><resource id="Value_::show_toolbar"/></resources>' .
84106
'</acl></config>',
85107
[
86-
"Element 'resource', attribute 'id': [facet 'pattern'] The value 'Value_::show_toolbar' is not " .
87-
"accepted by the pattern '([A-Z]+[a-zA-Z0-9]{1,}){1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.\nLine: 1\n"
108+
"Element 'resource', attribute 'id': [facet 'pattern'] The value 'Value_::show_toolbar' is not accepted " .
109+
"by the pattern '([A-Z]+[a-zA-Z0-9]{1,}){1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.\nLine: 1\n" .
110+
"The xml was: \n0:<?xml version=\"1.0\"?>\n1:<config><acl><resources><resource " .
111+
"id=\"Value_::show_toolbar\"/></resources></acl></config>\n2:\n"
88112
],
89113
],
90114
'notvalid_id_attribute_value_regexp6' => [
91115
'<?xml version="1.0"?><config><acl><resources><resource id="Test_value:show_toolbar"/>' .
92116
'</resources></acl></config>',
93117
[
94118
"Element 'resource', attribute 'id': [facet 'pattern'] The value 'Test_value:show_toolbar' is not " .
95-
"accepted by the pattern '([A-Z]+[a-zA-Z0-9]{1,}){1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.\nLine: 1\n"
119+
"accepted by the pattern '([A-Z]+[a-zA-Z0-9]{1,}){1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.\n" .
120+
"Line: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n1:<config><acl><resources><resource " .
121+
"id=\"Test_value:show_toolbar\"/></resources></acl></config>\n2:\n"
96122
],
97123
],
98124
'notvalid_id_attribute_value_regexp7' => [
99-
'<?xml version="1.0"?><config><acl><resources><resource id="Test_Value::"/></resources>' . '</acl></config>',
125+
'<?xml version="1.0"?><config><acl><resources><resource id="Test_Value::"/></resources>' .
126+
'</acl></config>',
100127
[
101128
"Element 'resource', attribute 'id': [facet 'pattern'] The value 'Test_Value::' is not accepted by " .
102-
"the pattern '([A-Z]+[a-zA-Z0-9]{1,}){1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.\nLine: 1\n"
129+
"the pattern '([A-Z]+[a-zA-Z0-9]{1,}){1,}_[A-Z]+[A-Z0-9a-z]{1,}::[A-Za-z_0-9]{1,}'.\nLine: 1\n" .
130+
"The xml was: \n0:<?xml version=\"1.0\"?>\n1:<config><acl><resources><resource " .
131+
"id=\"Test_Value::\"/></resources></acl></config>\n2:\n"
103132
],
104133
],
105134
'sortOrder_attribute_empty_value' => [
106135
'<?xml version="1.0"?><config><acl><resources><resource id="Test_Value::show_toolbar" ' .
107136
'title="Lorem ipsum" sortOrder="stringValue"/></resources></acl></config>',
108137
[
109-
"Element 'resource', attribute 'sortOrder': 'stringValue' is not a valid value of the atomic " .
110-
"type 'xs:int'.\nLine: 1\n"
138+
"Element 'resource', attribute 'sortOrder': 'stringValue' is not a valid value of the atomic type " .
139+
"'xs:int'.\nLine: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n1:<config><acl><resources><resource " .
140+
"id=\"Test_Value::show_toolbar\" title=\"Lorem ipsum\" sortOrder=\"stringValue\"/></resources>" .
141+
"</acl></config>\n2:\n"
111142
],
112143
],
113144
'sortOrder_attribute_wrong_type_value' => [
114-
'<?xml version="1.0"?><config><acl><resources><resource id="Test_Value::show_toolbar" ' .
145+
'<?xml version="1.0"?><config><acl><resources><resource id="Test_Value::show_toolbar" ' .
115146
'title="Lorem ipsum" sortOrder=""/></resources></acl></config>',
116-
["Element 'resource', attribute 'sortOrder': '' is not a valid value of the atomic type 'xs:int'.\nLine: 1\n"],
147+
[
148+
"Element 'resource', attribute 'sortOrder': '' is not a valid value of the atomic type 'xs:int'.\n" .
149+
"Line: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n1:<config><acl><resources><resource " .
150+
"id=\"Test_Value::show_toolbar\" title=\"Lorem ipsum\" sortOrder=\"\"/></resources></acl></config>\n2:\n"
151+
],
117152
],
118153
'with_not_allowed_attribute' => [
119154
'<?xml version="1.0"?><config><acl><resources><resource id="Test_Value::show_toolbar" ' .
120155
'someatrrname="some value"/></resources></acl></config>',
121-
["Element 'resource', attribute 'someatrrname': The attribute 'someatrrname' is not allowed.\nLine: 1\n"],
156+
[
157+
"Element 'resource', attribute 'someatrrname': The attribute 'someatrrname' is not allowed.\nLine: 1\n" .
158+
"The xml was: \n0:<?xml version=\"1.0\"?>\n1:<config><acl><resources><resource " .
159+
"id=\"Test_Value::show_toolbar\" someatrrname=\"some value\"/></resources>" .
160+
"</acl></config>\n2:\n"
161+
],
122162
],
123163
'with_two_same_id' => [
124164
'<?xml version="1.0"?><config><acl><resources><resource id="Test_Value::show_toolbar" ' .
125165
'title="Lorem ipsum"/><resource id="Test_Value::show_toolbar" title="Lorem ipsum"/>' .
126166
'</resources></acl></config>',
127167
[
128168
"Element 'resource': Duplicate key-sequence ['Test_Value::show_toolbar'] in unique identity-constraint " .
129-
"'uniqueResourceId'.\nLine: 1\n"
169+
"'uniqueResourceId'.\nLine: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n1:<config><acl><resources>" .
170+
"<resource id=\"Test_Value::show_toolbar\" title=\"Lorem ipsum\"/><resource " .
171+
"id=\"Test_Value::show_toolbar\" title=\"Lorem ipsum\"/></resources></acl></config>\n2:\n"
130172
],
131173
],
132174
'without_acl' => [
133175
'<?xml version="1.0"?><config/>',
134-
["Element 'config': Missing child element(s). Expected is ( acl ).\nLine: 1\n"],
176+
[
177+
"Element 'config': Missing child element(s). Expected is ( acl ).\nLine: 1\nThe xml was: \n" .
178+
"0:<?xml version=\"1.0\"?>\n1:<config/>\n2:\n"
179+
],
135180
],
136181
'without_required_id_attribute' => [
137182
'<?xml version="1.0"?><config><acl><resources><resource title="Notifications"/></resources></acl></config>',
138-
["Element 'resource': The attribute 'id' is required but missing.\nLine: 1\n"],
183+
[
184+
"Element 'resource': The attribute 'id' is required but missing.\nLine: 1\nThe xml was: \n" .
185+
"0:<?xml version=\"1.0\"?>\n1:<config><acl><resources><resource title=\"Notifications\"/>" .
186+
"</resources></acl></config>\n2:\n"
187+
],
139188
],
140189
'without_resource' => [
141190
'<?xml version="1.0"?><config><acl/></config>',
142-
["Element 'acl': Missing child element(s). Expected is ( resources ).\nLine: 1\n"],
143-
]
191+
[
192+
"Element 'acl': Missing child element(s). Expected is ( resources ).\nLine: 1\nThe xml was: \n" .
193+
"0:<?xml version=\"1.0\"?>\n1:<config><acl/></config>\n2:\n"
194+
],
195+
],
144196
];

0 commit comments

Comments
 (0)