Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
invalidLayoutArgumentsXmlArray.php
Go to the documentation of this file.
1 <?php
6 return [
7  'options without model attribute' => [
8  '<?xml version="1.0"?><page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
9  <body>
10  <block class="Magento\Test\Block" name="test.block">
11  <arguments>
12  <argument name="argumentName" xsi:type="options" />
13  </arguments>
14  </block>
15  </body>
16  </page>',
17  ["Element 'argument': The attribute 'model' is required but missing.\nLine: 5\n"], ],
18  'url without path attribute' => [
19  '<?xml version="1.0"?><page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
20  <body>
21  <block class="Magento\Test\Block" name="test.block">
22  <arguments>
23  <argument name="argumentName" xsi:type="url" />
24  </arguments>
25  </block>
26  </body>
27  </page>',
28  ["Element 'argument': The attribute 'path' is required but missing.\nLine: 5\n"], ],
29  'url without param name' => [
30  '<?xml version="1.0"?><page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
31  <body>
32  <block class="Magento\Test\Block" name="test.block">
33  <arguments>
34  <argument name="argumentName" xsi:type="url" path="module/controller/action">
35  <param />
36  </argument>
37  </arguments>
38  </block>
39  </body>
40  </page>',
41  ["Element 'param': The attribute 'name' is required but missing.\nLine: 6\n"], ],
42  'url with forbidden param attribute' => [
43  '<?xml version="1.0"?><page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
44  <body>
45  <block class="Magento\Test\Block" name="test.block">
46  <arguments>
47  <argument name="argumentName" xsi:type="url" path="module/controller/action">
48  <param name="paramName" forbidden="forbidden"/>
49  </argument>
50  </arguments>
51  </block>
52  </body>
53  </page>',
54  ["Element 'param', attribute 'forbidden': The attribute 'forbidden' is not allowed.\nLine: 6\n"], ],
55  'url with forbidden param sub-element' => [
56  '<?xml version="1.0"?><page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
57  <body>
58  <block class="Magento\Test\Block" name="test.block">
59  <arguments>
60  <argument name="argumentName" xsi:type="url" path="module/controller/action">
61  <param name="paramName"><forbidden /></param>
62  </argument>
63  </arguments>
64  </block>
65  </body>
66  </page>',
67  ["Element 'forbidden': This element is not expected.\nLine: 6\n"], ],
68  'helper without helper attribute' => [
69  '<?xml version="1.0"?><page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
70  <body>
71  <block class="Magento\Test\Block" name="test.block">
72  <arguments>
73  <argument name="argumentName" xsi:type="helper" />
74  </arguments>
75  </block>
76  </body>
77  </page>',
78  ["Element 'argument': The attribute 'helper' is required but missing.\nLine: 5\n"], ],
79  'helper without param name' => [
80  '<?xml version="1.0"?><page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
81  <body>
82  <block class="Magento\Test\Block" name="test.block">
83  <arguments>
84  <argument name="argumentName" xsi:type="helper"
85  helper="Magento\Framework\View\Layout\Argument\Handler\TestHelper::testMethod">
86  <param />
87  </argument>
88  </arguments>
89  </block>
90  </body>
91  </page>',
92  ["Element 'param': The attribute 'name' is required but missing.\nLine: 7\n"], ],
93  'helper with forbidden param attribute' => [
94  '<?xml version="1.0"?><page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
95  <body>
96  <block class="Magento\Test\Block" name="test.block">
97  <arguments>
98  <argument name="argumentName" xsi:type="helper"
99  helper="Magento\Framework\View\Layout\Argument\Handler\TestHelper::testMethod">
100  <param name="paramName" forbidden="forbidden"/>
101  </argument>
102  </arguments>
103  </block>
104  </body>
105  </page>',
106  ["Element 'param', attribute 'forbidden': The attribute 'forbidden' is not allowed.\nLine: 7\n"], ],
107  'helper with forbidden param sub-element' => [
108  '<?xml version="1.0"?><page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
109  <body>
110  <block class="Magento\Test\Block" name="test.block">
111  <arguments>
112  <argument name="argumentName" xsi:type="helper"
113  helper="Magento\Framework\View\Layout\Argument\Handler\TestHelper::testMethod">
114  <param name="paramName"><forbidden /></param>
115  </argument>
116  </arguments>
117  </block>
118  </body>
119  </page>',
120  ["Element 'forbidden': This element is not expected.\nLine: 7\n"], ],
121  'action with doubled arguments' => [
122  '<?xml version="1.0"?><page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
123  <body>
124  <block class="Magento\Test\Block" name="test.block">
125  <action method="testAction">
126  <argument name="string" xsi:type="string">string1</argument>
127  <argument name="string" xsi:type="string">string2</argument>
128  </action>
129  </block>
130  </body>
131  </page>',
132  [
133  "Element 'argument': Duplicate key-sequence ['string'] in key identity-constraint"
134  . " 'blockActionArgumentName'.\nLine: 6\n"
135  ],
136  ],
137 ];