Skip to content

Commit 6036ec8

Browse files
committed
Fixed Unit test failure of framework module
1 parent e53a91c commit 6036ec8

File tree

10 files changed

+467
-99
lines changed

10 files changed

+467
-99
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public function testMergedXml($fixtureXml, array $expectedErrors)
3737

3838
/**
3939
* @return array
40+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
4041
*/
4142
public function mergedXmlDataProvider()
4243
{

app/code/Magento/Sales/Test/Unit/Model/Config/XsdTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public function testInvalidXmlFile($xmlFile, $expectedErrors)
6666

6767
/**
6868
* @return array
69+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
6970
*/
7071
public function invalidXmlFileDataProvider()
7172
{

lib/internal/Magento/Framework/MessageQueue/Test/Unit/Consumer/Config/XsdTest.php

Lines changed: 105 additions & 16 deletions
Large diffs are not rendered by default.

lib/internal/Magento/Framework/MessageQueue/Test/Unit/Publisher/XsdTest.php

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,13 @@ public function exemplarXmlDataProvider()
8080
</publisher>
8181
</config>',
8282
[
83-
"Element 'publisher': Duplicate key-sequence ['topic.message.queue.config.01'] in unique identity-constraint 'unique-publisher-topic'."
83+
"Element 'publisher': Duplicate key-sequence ['topic.message.queue.config.01'] in unique identity-constraint 'unique-publisher-topic'.The xml was: \n" .
84+
"0:<?xml version=\"1.0\"?>\n1:<config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework-message-queue:etc/publisher.xsd\">\n" .
85+
"2: <publisher topic=\"topic.message.queue.config.01\">\n" .
86+
"3: <connection name=\"amqp\" exchange=\"magento2\"/>\n" .
87+
"4: </publisher>\n5: <publisher topic=\"topic.message.queue.config.01\">\n" .
88+
"6: <connection name=\"amqp\" exchange=\"magento2\" disabled=\"true\"/>\n7: </publisher>\n" .
89+
"8: </config>\n9:\n"
8490
],
8591
],
8692
'non unique publisher connection name' => [
@@ -91,7 +97,12 @@ public function exemplarXmlDataProvider()
9197
</publisher>
9298
</config>',
9399
[
94-
"Element 'connection': Duplicate key-sequence ['amqp'] in unique identity-constraint 'unique-connection-name'."
100+
"Element 'connection': Duplicate key-sequence ['amqp'] in unique identity-constraint 'unique-connection-name'.The xml was: \n" .
101+
"0:<?xml version=\"1.0\"?>\n1:<config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework-message-queue:etc/publisher.xsd\">\n" .
102+
"2: <publisher topic=\"topic.message.queue.config.01\">\n" .
103+
"3: <connection name=\"amqp\" exchange=\"magento2\"/>\n" .
104+
"4: <connection name=\"amqp\" exchange=\"magento2\"/>\n" .
105+
"5: </publisher>\n6: </config>\n7:\n"
95106
],
96107
],
97108
'missed required publisher attribute' => [
@@ -101,7 +112,13 @@ public function exemplarXmlDataProvider()
101112
</publisher>
102113
</config>',
103114
[
104-
"Element 'publisher': The attribute 'topic' is required but missing."
115+
"Element 'publisher': The attribute 'topic' is required but missing.The xml was: \n" .
116+
"0:<?xml version=\"1.0\"?>\n1:<config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework-message-queue:etc/publisher.xsd\">\n" .
117+
"2: <publisher disabled=\"false\">\n" .
118+
"3: <connection name=\"amqp\" exchange=\"magento2\"/>\n" .
119+
"4: </publisher>\n5: </config>\n6:\n"
120+
121+
105122
],
106123
],
107124
'missed required connection attribute' => [
@@ -118,7 +135,11 @@ public function exemplarXmlDataProvider()
118135
<publisher topic="topic.message.queue.config.03" disabled="true" />
119136
</config>',
120137
[
121-
"Element 'unexpected': This element is not expected. Expected is ( publisher )."
138+
"Element 'unexpected': This element is not expected. Expected is ( publisher ).The xml was: \n" .
139+
"0:<?xml version=\"1.0\"?>\n1:<config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework-message-queue:etc/publisher.xsd\">\n" .
140+
"2: <unexpected name=\"10\">20</unexpected>\n" .
141+
"3: <publisher topic=\"topic.message.queue.config.03\" disabled=\"true\"/>\n" .
142+
"4: </config>\n5:\n"
122143
],
123144
],
124145
'unexpected connection element' => [
@@ -129,15 +150,23 @@ public function exemplarXmlDataProvider()
129150
</publisher>
130151
</config>',
131152
[
132-
"Element 'unexpected': This element is not expected. Expected is ( connection )."
153+
"Element 'unexpected': This element is not expected. Expected is ( connection ).The xml was: \n" .
154+
"0:<?xml version=\"1.0\"?>\n1:<config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework-message-queue:etc/publisher.xsd\">\n" .
155+
"2: <publisher topic=\"topic.message.queue.config.03\" disabled=\"true\">\n" .
156+
"3: <connection name=\"amqp\" exchange=\"magento2\"/>\n" .
157+
"4: <unexpected name=\"10\">20</unexpected>\n" .
158+
"5: </publisher>\n6: </config>\n7:\n"
133159
],
134160
],
135161
'unexpected publisher attribute' => [
136162
'<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework-message-queue:etc/publisher.xsd">
137163
<publisher topic="topic.message.queue.config.03" disabled="true" unexpected="10"/>
138164
</config>',
139165
[
140-
"Element 'publisher', attribute 'unexpected': The attribute 'unexpected' is not allowed.",
166+
"Element 'publisher', attribute 'unexpected': The attribute 'unexpected' is not allowed.The xml was: \n" .
167+
"0:<?xml version=\"1.0\"?>\n1:<config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework-message-queue:etc/publisher.xsd\">\n" .
168+
"2: <publisher topic=\"topic.message.queue.config.03\" disabled=\"true\" unexpected=\"10\"/>\n" .
169+
"3: </config>\n4:\n",
141170
],
142171
],
143172
'unexpected connection attribute' => [
@@ -147,7 +176,11 @@ public function exemplarXmlDataProvider()
147176
</publisher>
148177
</config>',
149178
[
150-
"Element 'connection', attribute 'unexpected': The attribute 'unexpected' is not allowed.",
179+
"Element 'connection', attribute 'unexpected': The attribute 'unexpected' is not allowed.The xml was: \n" .
180+
"0:<?xml version=\"1.0\"?>\n1:<config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework-message-queue:etc/publisher.xsd\">\n" .
181+
"2: <publisher topic=\"topic.message.queue.config.03\" disabled=\"true\">\n" .
182+
"3: <connection name=\"amqp\" exchange=\"magento2\" unexpected=\"10\"/>\n" .
183+
"4: </publisher>\n5: </config>\n6:\n",
151184
],
152185
],
153186
'invalid connection attribute value' => [
@@ -157,7 +190,11 @@ public function exemplarXmlDataProvider()
157190
</publisher>
158191
</config>',
159192
[
160-
"Element 'connection', attribute 'disabled': 'disabled' is not a valid value of the atomic type 'xs:boolean'.",
193+
"Element 'connection', attribute 'disabled': 'disabled' is not a valid value of the atomic type 'xs:boolean'.The xml was: \n" .
194+
"0:<?xml version=\"1.0\"?>\n1:<config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework-message-queue:etc/publisher.xsd\">\n" .
195+
"2: <publisher topic=\"topic.message.queue.config.03\" disabled=\"true\">\n" .
196+
"3: <connection name=\"amqp\" exchange=\"magento2\" disabled=\"disabled\"/>\n" .
197+
"4: </publisher>\n5: </config>\n6:\n",
161198
],
162199
],
163200
'invalid publisher attribute value' => [
@@ -167,7 +204,11 @@ public function exemplarXmlDataProvider()
167204
</publisher>
168205
</config>',
169206
[
170-
"Element 'publisher', attribute 'disabled': 'disabled' is not a valid value of the atomic type 'xs:boolean'.",
207+
"Element 'publisher', attribute 'disabled': 'disabled' is not a valid value of the atomic type 'xs:boolean'.The xml was: \n" .
208+
"0:<?xml version=\"1.0\"?>\n1:<config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework-message-queue:etc/publisher.xsd\">\n" .
209+
"2: <publisher topic=\"topic.message.queue.config.03\" disabled=\"disabled\">\n" .
210+
"3: <connection name=\"amqp\" exchange=\"magento2\"/>\n" .
211+
"4: </publisher>\n5: </config>\n6:\n",
171212
],
172213
],
173214
];

lib/internal/Magento/Framework/MessageQueue/Test/Unit/Topology/MergedXsdTest.php

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,11 @@ public function exemplarXmlDataProvider()
8484
<exchange name="ex01" type="topic" connection="amqp" />
8585
</config>',
8686
[
87-
"Element 'exchange': Duplicate key-sequence ['ex01', 'amqp'] in unique identity-constraint 'unique-exchange-name-connection'."
87+
"Element 'exchange': Duplicate key-sequence ['ex01', 'amqp'] in unique identity-constraint 'unique-exchange-name-connection'.The xml was: \n" .
88+
"0:<?xml version=\"1.0\"?>\n1:<config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework-message-queue:etc/topology.xsd\">\n" .
89+
"2: <exchange name=\"ex01\" type=\"topic\" connection=\"amqp\"/>\n" .
90+
"3: <exchange name=\"ex01\" type=\"topic\" connection=\"amqp\"/>\n" .
91+
"4: </config>\n5:\n"
8892
],
8993
],
9094
'non-unique-exchange-binding' => [
@@ -95,7 +99,12 @@ public function exemplarXmlDataProvider()
9599
</exchange>
96100
</config>',
97101
[
98-
"Element 'binding': Duplicate key-sequence ['bind01'] in unique identity-constraint 'unique-binding-id'."
102+
"Element 'binding': Duplicate key-sequence ['bind01'] in unique identity-constraint 'unique-binding-id'.The xml was: \n" .
103+
"0:<?xml version=\"1.0\"?>\n1:<config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework-message-queue:etc/topology.xsd\">\n" .
104+
"2: <exchange name=\"ex01\" connection=\"amqp\" type=\"topic\">\n" .
105+
"3: <binding id=\"bind01\" destinationType=\"queue\" destination=\"queue01\" topic=\"top01\" disabled=\"true\"/>\n" .
106+
"4: <binding id=\"bind01\" destinationType=\"queue\" destination=\"queue01\" topic=\"top01\"/>\n" .
107+
"5: </exchange>\n6: </config>\n7:\n"
99108
],
100109
],
101110
'invalid-destination-type-binding' => [
@@ -105,7 +114,11 @@ public function exemplarXmlDataProvider()
105114
</exchange>
106115
</config>',
107116
[
108-
"Element 'binding', attribute 'destinationType': [facet 'enumeration'] The value 'topic' is not an element of the set {'queue'}."
117+
"Element 'binding', attribute 'destinationType': [facet 'enumeration'] The value 'topic' is not an element of the set {'queue'}.The xml was: \n" .
118+
"0:<?xml version=\"1.0\"?>\n1:<config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework-message-queue:etc/topology.xsd\">\n" .
119+
"2: <exchange name=\"ex01\" type=\"topic\" connection=\"amqp\">\n" .
120+
"3: <binding id=\"bind01\" destinationType=\"topic\" destination=\"queue01\" topic=\"top01\"/>\n" .
121+
"4: </exchange>\n5: </config>\n6:\n"
109122
],
110123
],
111124
'invalid-exchange-type-binding' => [
@@ -115,7 +128,11 @@ public function exemplarXmlDataProvider()
115128
</exchange>
116129
</config>',
117130
[
118-
"Element 'exchange', attribute 'type': [facet 'enumeration'] The value 'exchange' is not an element of the set {'topic'}."
131+
"Element 'exchange', attribute 'type': [facet 'enumeration'] The value 'exchange' is not an element of the set {'topic'}.The xml was: \n" .
132+
"0:<?xml version=\"1.0\"?>\n1:<config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework-message-queue:etc/topology.xsd\">\n" .
133+
"2: <exchange name=\"ex01\" type=\"exchange\" connection=\"db\">\n" .
134+
"3: <binding id=\"bind01\" destinationType=\"queue\" destination=\"queue01\" topic=\"top01\"/>\n" .
135+
"4: </exchange>\n5: </config>\n6:\n"
119136
],
120137
],
121138
'missed-required-attributes' => [

lib/internal/Magento/Framework/MessageQueue/Test/Unit/Topology/XsdTest.php

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,11 @@ public function exemplarXmlDataProvider()
8484
<exchange name="ex01" type="topic" connection="amqp" />
8585
</config>',
8686
[
87-
"Element 'exchange': Duplicate key-sequence ['ex01', 'amqp'] in unique identity-constraint 'unique-exchange-name-connection'."
87+
"Element 'exchange': Duplicate key-sequence ['ex01', 'amqp'] in unique identity-constraint 'unique-exchange-name-connection'.The xml was: \n" .
88+
"0:<?xml version=\"1.0\"?>\n1:<config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework-message-queue:etc/topology.xsd\">\n" .
89+
"2: <exchange name=\"ex01\" type=\"topic\" connection=\"amqp\"/>\n" .
90+
"3: <exchange name=\"ex01\" type=\"topic\" connection=\"amqp\"/>\n" .
91+
"4: </config>\n5:\n"
8892
],
8993
],
9094
'non-unique-exchange-binding' => [
@@ -95,7 +99,12 @@ public function exemplarXmlDataProvider()
9599
</exchange>
96100
</config>',
97101
[
98-
"Element 'binding': Duplicate key-sequence ['bind01'] in unique identity-constraint 'unique-binding-id'."
102+
"Element 'binding': Duplicate key-sequence ['bind01'] in unique identity-constraint 'unique-binding-id'.The xml was: \n" .
103+
"0:<?xml version=\"1.0\"?>\n1:<config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework-message-queue:etc/topology.xsd\">\n" .
104+
"2: <exchange name=\"ex01\" connection=\"amqp\">\n" .
105+
"3: <binding id=\"bind01\" destinationType=\"queue\" destination=\"queue01\" topic=\"top01\" disabled=\"true\"/>\n" .
106+
"4: <binding id=\"bind01\" destinationType=\"queue\" destination=\"queue01\" topic=\"top01\"/>\n" .
107+
"5: </exchange>\n6: </config>\n7:\n"
99108
],
100109
],
101110
'invalid-destination-type-binding' => [
@@ -105,7 +114,11 @@ public function exemplarXmlDataProvider()
105114
</exchange>
106115
</config>',
107116
[
108-
"Element 'binding', attribute 'destinationType': [facet 'enumeration'] The value 'topic' is not an element of the set {'queue'}."
117+
"Element 'binding', attribute 'destinationType': [facet 'enumeration'] The value 'topic' is not an element of the set {'queue'}.The xml was: \n" .
118+
"0:<?xml version=\"1.0\"?>\n1:<config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework-message-queue:etc/topology.xsd\">\n" .
119+
"2: <exchange name=\"ex01\" type=\"topic\" connection=\"amqp\">\n" .
120+
"3: <binding id=\"bind01\" destinationType=\"topic\" destination=\"queue01\" topic=\"top01\"/>\n" .
121+
"4: </exchange>\n5: </config>\n6:\n"
109122
],
110123
],
111124
'invalid-exchange-type-binding' => [
@@ -115,7 +128,11 @@ public function exemplarXmlDataProvider()
115128
</exchange>
116129
</config>',
117130
[
118-
"Element 'exchange', attribute 'type': [facet 'enumeration'] The value 'exchange' is not an element of the set {'topic'}."
131+
"Element 'exchange', attribute 'type': [facet 'enumeration'] The value 'exchange' is not an element of the set {'topic'}.The xml was: \n" .
132+
"0:<?xml version=\"1.0\"?>\n1:<config xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework-message-queue:etc/topology.xsd\">\n" .
133+
"2: <exchange name=\"ex01\" type=\"exchange\" connection=\"amqp\">\n" .
134+
"3: <binding id=\"bind01\" destinationType=\"queue\" destination=\"queue01\" topic=\"top01\"/>\n" .
135+
"4: </exchange>\n5: </config>\n6:\n"
119136
],
120137
],
121138
];

0 commit comments

Comments
 (0)