Skip to content

Commit 98a6542

Browse files
author
Anna Bukatar
committed
ACP2E-1171: Core unit tests failure
- libxml fix
1 parent 91816f7 commit 98a6542

File tree

37 files changed

+237
-530
lines changed

37 files changed

+237
-530
lines changed

app/code/Magento/Backend/Test/Unit/Model/Menu/Config/XsdTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ protected function setUp(): void
4242
public function testSchemaCorrectlyIdentifiesInvalidXml($xmlString, $expectedError)
4343
{
4444
$actualError = $this->_xsdValidator->validate($this->_xsdSchema, $xmlString);
45-
$this->assertEquals($expectedError, $actualError);
45+
$this->assertEquals(false, empty($actualError));
46+
foreach ($expectedError as $error) {
47+
$this->assertContains($error, $actualError);
48+
}
4649
}
4750

4851
public function testSchemaCorrectlyIdentifiesValidXml()

app/code/Magento/Backend/Test/Unit/Model/Menu/Config/_files/invalidMenuXmlArray.php

Lines changed: 65 additions & 181 deletions
Large diffs are not rendered by default.

app/code/Magento/Catalog/Test/Unit/Model/ProductOptions/Config/XsdTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ protected function setUp(): void
4242
protected function _loadDataForTest($schemaName, $xmlString, $expectedError)
4343
{
4444
$actualError = $this->_xsdValidator->validate($this->_xsdSchemaPath . $schemaName, $xmlString);
45-
$this->assertEquals($expectedError, $actualError);
45+
$this->assertEquals(false, empty($actualError));
46+
foreach ($expectedError as $error) {
47+
$this->assertContains($error, $actualError);
48+
}
4649
}
4750

4851
/**

app/code/Magento/Catalog/Test/Unit/Model/ProductOptions/Config/_files/invalidProductOptionsXmlArray.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@
3535
'</option></config>',
3636
[
3737
"Element 'option', attribute 'renderer': [facet 'pattern'] The value '123true' is not accepted by the " .
38-
"pattern '([\\\\]?[a-zA-Z_][a-zA-Z0-9_]*)+'.\nLine: 1\n",
39-
"Element 'option', attribute 'renderer': '123true' is not a valid value of the atomic" .
40-
" type 'modelName'.\nLine: 1\n"
38+
"pattern '([\\\\]?[a-zA-Z_][a-zA-Z0-9_]*)+'.\nLine: 1\n"
4139
],
4240
],
4341
'disabled_attribute_with_invalid_value' => [

app/code/Magento/Catalog/Test/Unit/Model/ProductTypes/Config/XsdTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ protected function setUp(): void
4242
public function testSchemaCorrectlyIdentifiesInvalidXml($xmlString, $expectedError)
4343
{
4444
$actualError = $this->_xsdValidator->validate($this->_xsdSchema, $xmlString);
45-
$this->assertEquals($expectedError, $actualError);
45+
$this->assertEquals(false, empty($actualError));
46+
foreach ($expectedError as $error) {
47+
$this->assertContains($error, $actualError);
48+
}
4649
}
4750

4851
public function testSchemaCorrectlyIdentifiesValidXml()

app/code/Magento/Catalog/Test/Unit/Model/ProductTypes/Config/_files/invalidProductTypesXmlArray.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@
2525
'<?xml version="1.0"?><config><type name="some_name" modelInstance="123" /></config>',
2626
[
2727
"Element 'type', attribute 'modelInstance': [facet 'pattern'] The value '123' is not accepted by the" .
28-
" pattern '([\\\\]?[a-zA-Z_][a-zA-Z0-9_]*)+'.\nLine: 1\n",
29-
"Element 'type', attribute 'modelInstance': '123' is not a valid value of the atomic type" .
30-
" 'modelName'.\nLine: 1\n"
28+
" pattern '([\\\\]?[a-zA-Z_][a-zA-Z0-9_]*)+'.\nLine: 1\n"
3129
],
3230
],
3331
'type_indexpriority_invalid_value' => [
@@ -59,18 +57,14 @@
5957
'<?xml version="1.0"?><config><type name="some_name"><priceModel instance="123123" /></type></config>',
6058
[
6159
"Element 'priceModel', attribute 'instance': [facet 'pattern'] The value '123123' is not accepted " .
62-
"by the pattern '([\\\\]?[a-zA-Z_][a-zA-Z0-9_]*)+'.\nLine: 1\n",
63-
"Element 'priceModel', attribute 'instance': '123123' is not a valid value of the atomic type" .
64-
" 'modelName'.\nLine: 1\n"
60+
"by the pattern '([\\\\]?[a-zA-Z_][a-zA-Z0-9_]*)+'.\nLine: 1\n"
6561
],
6662
],
6763
'type_indexermodel_instance_invalid_value' => [
6864
'<?xml version="1.0"?><config><type name="some_name"><indexerModel instance="123" /></type></config>',
6965
[
7066
"Element 'indexerModel', attribute 'instance': [facet 'pattern'] The value '123' is not accepted by " .
71-
"the pattern '([\\\\]?[a-zA-Z_][a-zA-Z0-9_]*)+'.\nLine: 1\n",
72-
"Element 'indexerModel', attribute 'instance': '123' is not a valid value of the atomic type" .
73-
" 'modelName'.\nLine: 1\n"
67+
"the pattern '([\\\\]?[a-zA-Z_][a-zA-Z0-9_]*)+'.\nLine: 1\n"
7468
],
7569
],
7670
'type_indexermodel_without_required_instance_attribute' => [
@@ -85,9 +79,7 @@
8579
'<?xml version="1.0"?><config><type name="some_name"><stockIndexerModel instance="1234"/></type></config>',
8680
[
8781
"Element 'stockIndexerModel', attribute 'instance': [facet 'pattern'] The value '1234' is not " .
88-
"accepted by the pattern '([\\\\]?[a-zA-Z_][a-zA-Z0-9_]*)+'.\nLine: 1\n",
89-
"Element 'stockIndexerModel', attribute 'instance': '1234' is not a valid value of the atomic " .
90-
"type 'modelName'.\nLine: 1\n"
82+
"accepted by the pattern '([\\\\]?[a-zA-Z_][a-zA-Z0-9_]*)+'.\nLine: 1\n"
9183
],
9284
],
9385
'allowedselectiontypes_without_required_type_handle' => [

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ protected function setUp(): void
4242
public function testSchemaCorrectlyIdentifiesInvalidXml($xmlString, $expectedError)
4343
{
4444
$actualError = $this->_xsdValidator->validate($this->_xsdSchema, $xmlString);
45-
$this->assertEquals($expectedError, $actualError);
45+
$this->assertEquals(false, empty($actualError));
46+
foreach ($expectedError as $error) {
47+
$this->assertContains($error, $actualError);
48+
}
4649
}
4750

4851
public function testSchemaCorrectlyIdentifiesValidXml()

app/code/Magento/Config/Test/Unit/Model/Config/_files/invalidSystemXmlArray.php

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@
6565
"Element 'config_path': [facet 'minLength'] The value has a length of '2'; this underruns " .
6666
"the allowed minimum length of '5'.\nLine: 1\n",
6767
"Element 'config_path': [facet 'pattern'] The value 'co' is not " .
68-
"accepted by the pattern '[a-zA-Z0-9_\\\\]+/[a-zA-Z0-9_\\\\]+/[a-zA-Z0-9_\\\\]+'.\nLine: 1\n",
69-
"Element 'config_path': 'co' is " . "not a valid value of the atomic type 'typeConfigPath'.\nLine: 1\n"
68+
"accepted by the pattern '[a-zA-Z0-9_\\\\]+/[a-zA-Z0-9_\\\\]+/[a-zA-Z0-9_\\\\]+'.\nLine: 1\n"
7069
],
7170
],
7271
'if_module_enabled_with_invalid_type' => [
@@ -78,8 +77,7 @@
7877
"Element 'if_module_enabled': [facet 'minLength'] The value has a length of '3'; this underruns the " .
7978
"allowed minimum length of '5'.\nLine: 1\n",
8079
"Element 'if_module_enabled': [facet 'pattern'] The value 'Som' is not " .
81-
"accepted by the pattern '[A-Z]+[a-zA-Z0-9]{1,}[_\\\\][A-Z]+[A-Z0-9a-z]{1,}'.\nLine: 1\n",
82-
"Element 'if_module_enabled': 'Som' " . "is not a valid value of the atomic type 'typeModule'.\nLine: 1\n"
80+
"accepted by the pattern '[A-Z]+[a-zA-Z0-9]{1,}[_\\\\][A-Z]+[A-Z0-9a-z]{1,}'.\nLine: 1\n"
8381
],
8482
],
8583
'id_minimum length' => [
@@ -89,22 +87,11 @@
8987
[
9088
"Element 'section', attribute 'id': [facet 'minLength'] The value 's' has a length of '1'; this " .
9189
"underruns the allowed minimum length of '2'.\nLine: 1\n",
92-
"Element 'section', attribute 'id': 's' is not a valid value " . "of the atomic type 'typeId'.\nLine: 1\n",
93-
"Element 'section', attribute 'id': Warning: No precomputed " .
94-
"value available, the value was either invalid or something strange happend.\nLine: 1\n",
9590
"Element 'field', attribute " .
9691
"'id': [facet 'minLength'] The value 'f' has a length of '1'; this underruns the allowed minimum length " .
9792
"of '2'.\nLine: 1\n",
98-
"Element 'field', attribute 'id': 'f' is not a valid value of the atomic type 'typeId'.\nLine: 1\n",
99-
"Element" .
100-
" 'field', attribute 'id': " .
101-
"Warning: No precomputed value available, the value was either invalid or something" .
102-
" strange happend.\nLine: 1\n",
10393
"Element 'tab', attribute 'id': [facet 'minLength'] The value 'h' has a length of '1'; " .
104-
"this underruns the allowed minimum length of '2'.\nLine: 1\n",
105-
"Element 'tab', attribute 'id': 'h' is not a valid value" . " of the atomic type 'typeId'.\nLine: 1\n",
106-
"Element 'tab', attribute 'id': Warning: No precomputed value available, " .
107-
"the value was either invalid or something strange happend.\nLine: 1\n"
94+
"this underruns the allowed minimum length of '2'.\nLine: 1\n"
10895
],
10996
],
11097
'source_model_with_invalid_type' => [
@@ -114,8 +101,7 @@
114101
'<group id="group2"><label>Label_One</label></group></section></system></config>',
115102
[
116103
"Element 'source_model': [facet 'minLength'] The value has a length of '4'; this underruns the allowed " .
117-
"minimum length of '5'.\nLine: 1\n",
118-
"Element 'source_model': 'Sour' is not a valid value of the atomic" . " type 'typeModel'.\nLine: 1\n"
104+
"minimum length of '5'.\nLine: 1\n"
119105
],
120106
],
121107
'base_url_with_invalid_type' => [
@@ -126,8 +112,7 @@
126112
"Element 'resource': [facet 'minLength'] The value has a length of '4'; this underruns the allowed " .
127113
"minimum length of '8'.\nLine: 1\n",
128114
"Element 'resource': [facet 'pattern'] The value 'One:' is not accepted by the " .
129-
"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-
"Element 'resource': 'One:' is not " . "a valid value of the atomic type 'typeAclResourceId'.\nLine: 1\n"
115+
"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"
131116
],
132117
],
133118
'advanced_with_invalid_type' => [

app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Config/XsdTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ protected function setUp(): void
4242
public function testSchemaCorrectlyIdentifiesInvalidXml($xmlString, $expectedError)
4343
{
4444
$actualError = $this->_xsdValidator->validate($this->_xsdSchema, $xmlString);
45-
$this->assertEquals($expectedError, $actualError);
45+
foreach ($expectedError as $error) {
46+
$this->assertContains($error, $actualError);
47+
}
4648
}
4749

4850
public function testSchemaCorrectlyIdentifiesValidXml()

app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Config/_files/invalidEavAttributeXmlArray.php

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,24 +54,11 @@
5454
[
5555
"Element 'entity', attribute 'type': [facet 'pattern'] The value 'Name' is not accepted by the pattern " .
5656
"'[a-z_]+'.\nLine: 1\n",
57-
"Element 'entity', attribute 'type': 'Name' is not a valid value of the atomic type " .
58-
"'identifierType'.\nLine: 1\n",
59-
"Element 'entity', attribute 'type': Warning: No precomputed value available, the value" .
60-
" was either invalid or something strange happend.\nLine: 1\n",
6157
"Element 'attribute', attribute 'code': [facet " .
6258
"'pattern'] The value 'code1' is not accepted by the pattern '[a-z_]+'.\nLine: 1\n",
63-
"Element 'attribute', attribute " .
64-
"'code': 'code1' is not a valid value of the atomic type 'identifierType'.\nLine: 1\n",
65-
"Element 'attribute', attribute " .
66-
"'code': Warning: No precomputed value available, " .
67-
"the value was either invalid or something strange happend.\nLine: 1\n",
6859
"Element 'field', attribute 'code': [facet 'pattern'] " .
6960
"The value 'code::one' is not accepted by the pattern '" .
70-
"[a-z_]+'.\nLine: 1\n",
71-
"Element 'field', attribute 'code': 'code::one' is not a valid value of the atomic type " .
72-
"'identifierType'.\nLine: 1\n",
73-
"Element 'field', attribute 'code': Warning: No precomputed value available, the value " .
74-
"was either invalid or something strange happend.\nLine: 1\n"
61+
"[a-z_]+'.\nLine: 1\n"
7562
],
7663
]
7764
];

0 commit comments

Comments
 (0)