Skip to content

Commit 8e37779

Browse files
committed
ACP2E-3520: [QUANS] Core unit test failures in 2.4.7-p3
1 parent 1eecb3b commit 8e37779

File tree

3 files changed

+37
-20
lines changed

3 files changed

+37
-20
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ protected function setUp(): void
3838
* @param string $schemaName
3939
* @param string $xmlString
4040
* @param array $expectedError
41+
* @param bool $isRegex
4142
*/
4243
protected function _loadDataForTest($schemaName, $xmlString, $expectedError, $isRegex = false)
4344
{
@@ -58,6 +59,7 @@ protected function _loadDataForTest($schemaName, $xmlString, $expectedError, $is
5859
/**
5960
* @param string $xmlString
6061
* @param array $expectedError
62+
* @param $isRegex
6163
* @dataProvider schemaCorrectlyIdentifiesInvalidProductOptionsDataProvider
6264
*/
6365
public function testSchemaCorrectlyIdentifiesInvalidProductOptionsXml($xmlString, $expectedError, $isRegex)

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

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2013 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -37,14 +37,22 @@ protected function setUp(): void
3737
/**
3838
* @param string $xmlString
3939
* @param array $expectedError
40+
* @param bool $isRegex
4041
* @dataProvider schemaCorrectlyIdentifiesInvalidXmlDataProvider
4142
*/
42-
public function testSchemaCorrectlyIdentifiesInvalidXml($xmlString, $expectedError)
43+
public function testSchemaCorrectlyIdentifiesInvalidXml($xmlString, $expectedError, $isRegex = false)
4344
{
44-
$actualError = $this->_xsdValidator->validate($this->_xsdSchema, $xmlString);
45-
$this->assertEquals(false, empty($actualError));
45+
$actualErrors = $this->_xsdValidator->validate($this->_xsdSchema, $xmlString);
46+
$this->assertEquals(false, empty($actualErrors));
47+
4648
foreach ($expectedError as $error) {
47-
$this->assertContains($error, $actualError);
49+
if ($isRegex) {
50+
foreach ($actualErrors as $actualError) {
51+
$this->assertMatchesRegularExpression($error, $actualError);
52+
}
53+
} else {
54+
$this->assertContains($error, $actualErrors);
55+
}
4856
}
4957
}
5058

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

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2013 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -13,13 +13,15 @@
1313
"Line: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n1:<config><type name=\"some_name\"/><type " .
1414
"name=\"some_name\"/></config>\n2:\n"
1515
],
16+
'isRegex' => false
1617
],
1718
'type_without_required_name_attribute' => [
1819
'<?xml version="1.0"?><config><type /></config>',
1920
[
2021
"Element 'type': The attribute 'name' is required but missing.\n" .
2122
"Line: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n1:<config><type/></config>\n2:\n"
2223
],
24+
'isRegex' => false
2325
],
2426
'type_with_notallowed_attribute' => [
2527
'<?xml version="1.0"?><config><type name="some_name" notallowed="text"/></config>',
@@ -28,14 +30,14 @@
2830
"Line: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n1:<config><type name=\"some_name\" " .
2931
"notallowed=\"text\"/></config>\n2:\n"
3032
],
33+
'isRegex' => false
3134
],
3235
'type_modelinstance_invalid_value' => [
3336
'<?xml version="1.0"?><config><type name="some_name" modelInstance="123" /></config>',
3437
[
35-
"Element 'type', attribute 'modelInstance': '123' is not a valid value of the atomic type 'modelName'.\n" .
36-
"Line: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n1:<config><type name=\"some_name\" " .
37-
"modelInstance=\"123\"/></config>\n2:\n"
38+
"/Element \'type\', attribute \'modelInstance\': .* (is not a valid value|is not accepted).*/"
3839
],
40+
'isRegex' => true
3941
],
4042
'type_indexpriority_invalid_value' => [
4143
'<?xml version="1.0"?><config><type name="some_name" indexPriority="-1" /></config>',
@@ -44,6 +46,7 @@
4446
"'xs:nonNegativeInteger'.\nLine: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n" .
4547
"1:<config><type name=\"some_name\" indexPriority=\"-1\"/></config>\n2:\n"
4648
],
49+
'isRegex' => false
4750
],
4851
'type_canuseqtydecimals_invalid_value' => [
4952
'<?xml version="1.0"?><config><type name="some_name" canUseQtyDecimals="string" /></config>',
@@ -52,6 +55,7 @@
5255
"'xs:boolean'.\nLine: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n" .
5356
"1:<config><type name=\"some_name\" canUseQtyDecimals=\"string\"/></config>\n2:\n"
5457
],
58+
'isRegex' => false
5559
],
5660
'type_isqty_invalid_value' => [
5761
'<?xml version="1.0"?><config><type name="some_name" isQty="string" /></config>',
@@ -60,36 +64,37 @@
6064
"\nLine: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n1:<config><type name=\"some_name\" " .
6165
"isQty=\"string\"/></config>\n2:\n"
6266
],
67+
'isRegex' => false
6368
],
6469
'type_pricemodel_without_required_instance_attribute' => [
6570
'<?xml version="1.0"?><config><type name="some_name"><priceModel /></type></config>',
6671
[
6772
"Element 'priceModel': The attribute 'instance' is required but missing.\nLine: 1\nThe xml was: \n" .
6873
"0:<?xml version=\"1.0\"?>\n1:<config><type name=\"some_name\"><priceModel/></type></config>\n2:\n"
6974
],
75+
'isRegex' => false
7076
],
7177
'type_pricemodel_instance_invalid_value' => [
7278
'<?xml version="1.0"?><config><type name="some_name"><priceModel instance="123123" /></type></config>',
7379
[
74-
"Element 'priceModel', attribute 'instance': '123123' is not a valid value of the atomic " .
75-
"type 'modelName'.\nLine: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n1:<config><type " .
76-
"name=\"some_name\"><priceModel instance=\"123123\"/></type></config>\n2:\n"
80+
"/Element \'priceModel\', attribute \'instance\': .* (is not a valid value|is not accepted).*/"
7781
],
82+
'isRegex' => true
7883
],
7984
'type_indexermodel_instance_invalid_value' => [
8085
'<?xml version="1.0"?><config><type name="some_name"><indexerModel instance="123" /></type></config>',
8186
[
82-
"Element 'indexerModel', attribute 'instance': '123' is not a valid value of the atomic type " .
83-
"'modelName'.\nLine: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n1:<config><type " .
84-
"name=\"some_name\"><indexerModel instance=\"123\"/></type></config>\n2:\n"
87+
"/Element \'indexerModel\', attribute \'instance\': .* (is not a valid value|is not accepted).*/"
8588
],
89+
'isRegex' => true
8690
],
8791
'type_indexermodel_without_required_instance_attribute' => [
8892
'<?xml version="1.0"?><config><type name="some_name"><indexerModel /></type></config>',
8993
[
9094
"Element 'indexerModel': The attribute 'instance' is required but missing.\nLine: 1\nThe xml was: \n" .
9195
"0:<?xml version=\"1.0\"?>\n1:<config><type name=\"some_name\"><indexerModel/></type></config>\n2:\n"
9296
],
97+
'isRegex' => false
9398
],
9499
'stockindexermodel_without_required_instance_attribute' => [
95100
'<?xml version="1.0"?><config><type name="some_name"><stockIndexerModel /></type></config>',
@@ -98,14 +103,14 @@
98103
"Line: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n" .
99104
"1:<config><type name=\"some_name\"><stockIndexerModel/></type></config>\n2:\n"
100105
],
106+
'isRegex' => false
101107
],
102108
'stockindexermodel_instance_invalid_value' => [
103109
'<?xml version="1.0"?><config><type name="some_name"><stockIndexerModel instance="1234"/></type></config>',
104110
[
105-
"Element 'stockIndexerModel', attribute 'instance': '1234' is not a valid value of the atomic type " .
106-
"'modelName'.\nLine: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n1:<config><type " .
107-
"name=\"some_name\"><stockIndexerModel instance=\"1234\"/></type></config>\n2:\n"
111+
"/Element \'stockIndexerModel\', attribute \'instance\': .* (is not a valid value|is not accepted).*/"
108112
],
113+
'isRegex' => true
109114
],
110115
'allowedselectiontypes_without_required_type_handle' => [
111116
'<?xml version="1.0"?><config><type name="some_name"><allowedSelectionTypes /></type></config>',
@@ -114,6 +119,7 @@
114119
"Line: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n1:<config><type name=\"some_name\">" .
115120
"<allowedSelectionTypes/></type></config>\n2:\n"
116121
],
122+
'isRegex' => false
117123
],
118124
'allowedselectiontypes_type_without_required_name' => [
119125
'<?xml version="1.0"?><config><type name="some_name"><allowedSelectionTypes><type/></allowedSelectionTypes>"
@@ -127,5 +133,6 @@
127133
"1:<config><type name=\"some_name\"><allowedSelectionTypes><type/>" .
128134
"</allowedSelectionTypes>\"\n2: . \"</type></config>\n3:\n"
129135
],
136+
'isRegex' => false
130137
]
131138
];

0 commit comments

Comments
 (0)