Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
invalidConfigXmlArray.php
Go to the documentation of this file.
1 <?php
6 return [
7  'preference_without_required_for_attribute' => [
8  '<?xml version="1.0"?><config><preference type="Some_Type_Name" /></config>',
9  ["Element 'preference': The attribute 'for' is required but missing.\nLine: 1\n"],
10  ],
11  'preference_without_required_type_attribute' => [
12  '<?xml version="1.0"?><config><preference for="Some_For_Name" /></config>',
13  ["Element 'preference': The attribute 'type' is required but missing.\nLine: 1\n"],
14  ],
15  'preferences_with_same_for_attribute_value' => [
16  '<?xml version="1.0"?>
17  <config>
18  <preference for="Some_For_Name" type="Some_Type_Name" />
19  <preference for="Some_For_Name" type="Some_Type_Name" />
20  </config>',
21  [
22  "Element 'preference': Duplicate key-sequence ['Some_For_Name'] in unique " .
23  "identity-constraint 'uniquePreference'.\nLine: 4\n"
24  ],
25  ],
26  'preferences_with_forbidden_attribute' => [
27  '<?xml version="1.0"?>
28  <config><preference for="Some_For_Name" type="Some_Type_Name" forbidden="text"/></config>',
29  ["Element 'preference', attribute 'forbidden': The attribute 'forbidden' is not allowed.\nLine: 2\n"],
30  ],
31  'type_without_required_name_attribute' => [
32  '<?xml version="1.0"?><config><type /></config>',
33  ["Element 'type': The attribute 'name' is required but missing.\nLine: 1\n"],
34  ],
35  'type_with_same_name_attribute_value' => [
36  '<?xml version="1.0"?>
37  <config>
38  <type name="Some_Type_name" />
39  <type name="Some_Type_name" />
40  </config>',
41  [
42  "Element 'type': Duplicate key-sequence ['Some_Type_name'] in unique identity-constraint"
43  . " 'uniqueType'.\nLine: 4\n"
44  ],
45  ],
46  'type_with_forbidden_attribute' => [
47  '<?xml version="1.0"?><config><type name="Some_Name" forbidden="text"/></config>',
48  ["Element 'type', attribute 'forbidden': The attribute 'forbidden' is not allowed.\nLine: 1\n"],
49  ],
50  'type_shared_attribute_with_forbidden_value' => [
51  '<?xml version="1.0"?><config><type name="Some_Name" shared="forbidden"/></config>',
52  [
53  "Element 'type', attribute 'shared': 'forbidden' is not a valid value of the atomic type"
54  . " 'xs:boolean'.\nLine: 1\n"
55  ],
56  ],
57  'type_object_with_forbidden_shared_value' => [
58  '<?xml version="1.0"?>
59  <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
60  <type name="Some_Name">
61  <arguments>
62  <argument name="Param_name" xsi:type="object" shared="forbidden">Object</argument>
63  </arguments>
64  </type>
65  </config>',
66  [
67  "Element 'argument', attribute 'shared': 'forbidden' is not a valid value of the atomic type"
68  . " 'xs:boolean'.\nLine: 5\n"
69  ],
70  ],
71  'type_instance_with_forbidden_attribute' => [
72  '<?xml version="1.0"?>
73  <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
74  <type name="Some_Name">
75  <arguments>
76  <argument name="Param_name" xsi:type="object" forbidden="text">Object</argument>
77  </arguments>
78  </type>
79  </config>',
80  ["Element 'argument', attribute 'forbidden': The attribute 'forbidden' is not allowed.\nLine: 5\n"],
81  ],
82  'type_plugin_without_required_name_attribute' => [
83  '<?xml version="1.0"?><config><type name="Some_Name"><plugin /></type></config>',
84  ["Element 'plugin': The attribute 'name' is required but missing.\nLine: 1\n"],
85  ],
86  'type_plugin_with_forbidden_attribute' => [
87  '<?xml version="1.0"?>
88  <config><type name="Some_Name"><plugin name="some_name" forbidden="text" /></type></config>',
89  ["Element 'plugin', attribute 'forbidden': The attribute 'forbidden' is not allowed.\nLine: 2\n"],
90  ],
91  'type_plugin_disabled_attribute_invalid_value' => [
92  '<?xml version="1.0"?>
93  <config><type name="Some_Name"><plugin name="some_name" disabled="string" /></type></config>',
94  [
95  "Element 'plugin', attribute 'disabled': 'string' is not a valid value of the atomic " .
96  "type 'xs:boolean'.\nLine: 2\n"
97  ],
98  ],
99  'type_plugin_sortorder_attribute_invalid_value' => [
100  '<?xml version="1.0"?>
101  <config><type name="Some_Name"><plugin name="some_name" sortOrder="string" /></type></config>',
102  [
103  "Element 'plugin', attribute 'sortOrder': 'string' is not a valid value of the atomic type"
104  . " 'xs:int'.\nLine: 2\n"
105  ],
106  ],
107  'type_with_same_argument_name_attribute' => [
108  '<?xml version="1.0"?>
109  <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
110  <type name="Some_Name">
111  <arguments>
112  <argument name="same_argument_name" xsi:type="string">value</argument>
113  <argument name="same_argument_name" xsi:type="string">value2</argument>
114  </arguments>
115  </type>
116  </config>',
117  [
118  "Element 'argument': Duplicate key-sequence ['same_argument_name'] in key identity-constraint " .
119  "'argumentName'.\nLine: 6\n"
120  ],
121  ],
122  'virtualtype_without_required_name_attribute' => [
123  '<?xml version="1.0"?><config><virtualType /></config>',
124  ["Element 'virtualType': The attribute 'name' is required but missing.\nLine: 1\n"],
125  ],
126  'virtualtype_with_forbidden_shared_attribute_value' => [
127  '<?xml version="1.0"?><config><virtualType name="virtual_name" shared="forbidden"/></config>',
128  [
129  "Element 'virtualType', attribute 'shared': 'forbidden' is not a valid value of the atomic " .
130  "type 'xs:boolean'.\nLine: 1\n"
131  ],
132  ],
133  'virtualtype_with_forbidden_attribute' => [
134  '<?xml version="1.0"?><config><virtualType name="virtual_name" forbidden="text"/></config>',
135  ["Element 'virtualType', attribute 'forbidden': The attribute 'forbidden' is not allowed.\nLine: 1\n"],
136  ],
137  'virtualtype_with_same_name_attribute_value' => [
138  '<?xml version="1.0"?><config><virtualType name="test_name" /><virtualType name="test_name" /></config>',
139  [
140  "Element 'virtualType': Duplicate key-sequence ['test_name'] in unique" .
141  " identity-constraint 'uniqueVirtualType'.\nLine: 1\n"
142  ],
143  ],
144  'virtualtype_with_same_argument_name_attribute' => [
145  '<?xml version="1.0"?>
146  <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
147  <virtualType name="virtual_name">
148  <arguments>
149  <argument name="same_param_name" xsi:type="string">value</argument>
150  <argument name="same_param_name" xsi:type="string">value2</argument>
151  </arguments>
152  </virtualType>
153  </config>',
154  [
155  "Element 'argument': Duplicate key-sequence ['same_param_name'] in key identity-constraint"
156  . " 'argumentName'.\nLine: 6\n"
157  ],
158  ],
159  'sorted_object_list_with_invalid_sortOrder_attribute_value' => [
160  '<?xml version="1.0"?>
161  <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
162  <type name="Some_Name">
163  <arguments>
164  <argument name="sorted_object_list" xsi:type="array">
165  <item name="someObject" xsi:type="object" sortOrder="false">Some_Class_Name</item>
166  </argument>
167  </arguments>
168  </type>
169  </config>',
170  [
171  "Element 'item', attribute 'sortOrder': 'false' is not a valid value of the atomic type 'xs:integer'." .
172  "\nLine: 6\n"
173  ],
174  ],
175  'virtualtype with empty_name' => [
176  '<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
177  <virtualType name="" type="TypeName" shared="true"/>
178  </config>',
179  [
180  "Element 'virtualType', attribute 'name': [facet 'pattern'] The value '' is not accepted by the pattern '" .
181  "(\\\\?[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)" .
182  "(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)*'." .
183  "\nLine: 2\n",
184  "Element 'virtualType', attribute 'name': '' is not a valid value of the atomic type 'phpClassName'." .
185  "\nLine: 2\n",
186  "Element 'virtualType', attribute 'name': Warning: No precomputed value available, the value was either " .
187  "invalid or something strange happend." .
188  "\nLine: 2\n",
189  ],
190  ],
191  'virtualtype with empty_type' => [
192  '<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
193  <virtualType name="Name" type="" shared="true"/>
194  </config>',
195  [
196  "Element 'virtualType', attribute 'type': [facet 'pattern'] The value '' is not accepted by the pattern '" .
197  "(\\\\?[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)" .
198  "(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)*'." .
199  "\nLine: 2\n",
200  "Element 'virtualType', attribute 'type': '' is not a valid value of the atomic type 'phpClassName'." .
201  "\nLine: 2\n",
202  ],
203  ],
204  'virtualtype with invalid_type' => [
205  '<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
206  <virtualType name="777Digits\\IsNotAllowed" type="TypeName" shared="true"/>
207  </config>',
208  [
209  "Element 'virtualType', attribute 'name': [facet 'pattern'] The value '777Digits\\IsNotAllowed' " .
210  "is not accepted by the pattern '" .
211  "(\\\\?[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)" .
212  "(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)*'." .
213  "\nLine: 2\n",
214  "Element 'virtualType', attribute 'name': '777Digits\\IsNotAllowed' " .
215  "is not a valid value of the atomic type 'phpClassName'." .
216  "\nLine: 2\n",
217  "Element 'virtualType', attribute 'name': Warning: No precomputed value available, the value was either " .
218  "invalid or something strange happend." .
219  "\nLine: 2\n",
220  ],
221  ],
222  'virtualtype with digits_and_prefix_slash' => [
223  '<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
224  <virtualType name="\\777Digits\\IsNotAllowed" type="TypeName" shared="true"/>
225  </config>',
226  [
227  "Element 'virtualType', attribute 'name': [facet 'pattern'] The value '\\777Digits\\IsNotAllowed' " .
228  "is not accepted by the pattern '" .
229  "(\\\\?[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)" .
230  "(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)*'." .
231  "\nLine: 2\n",
232  "Element 'virtualType', attribute 'name': '\\777Digits\\IsNotAllowed' " .
233  "is not a valid value of the atomic type 'phpClassName'." .
234  "\nLine: 2\n",
235  "Element 'virtualType', attribute 'name': Warning: No precomputed value available, the value was either " .
236  "invalid or something strange happend." .
237  "\nLine: 2\n",
238  ],
239  ],
240 ];