Skip to content

Commit 1eecb3b

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

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

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

Lines changed: 15 additions & 8 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

@@ -39,12 +39,19 @@ protected function setUp(): void
3939
* @param string $xmlString
4040
* @param array $expectedError
4141
*/
42-
protected function _loadDataForTest($schemaName, $xmlString, $expectedError)
42+
protected function _loadDataForTest($schemaName, $xmlString, $expectedError, $isRegex = false)
4343
{
44-
$actualError = $this->_xsdValidator->validate($this->_xsdSchemaPath . $schemaName, $xmlString);
45-
$this->assertEquals(false, empty($actualError));
44+
$actualErrors = $this->_xsdValidator->validate($this->_xsdSchemaPath . $schemaName, $xmlString);
45+
$this->assertNotEmpty($actualErrors);
46+
4647
foreach ($expectedError as $error) {
47-
$this->assertContains($error, $actualError);
48+
if ($isRegex) {
49+
foreach ($actualErrors as $actualError) {
50+
$this->assertMatchesRegularExpression($error, $actualError);
51+
}
52+
} else {
53+
$this->assertContains($error, $actualErrors);
54+
}
4855
}
4956
}
5057

@@ -53,9 +60,9 @@ protected function _loadDataForTest($schemaName, $xmlString, $expectedError)
5360
* @param array $expectedError
5461
* @dataProvider schemaCorrectlyIdentifiesInvalidProductOptionsDataProvider
5562
*/
56-
public function testSchemaCorrectlyIdentifiesInvalidProductOptionsXml($xmlString, $expectedError)
63+
public function testSchemaCorrectlyIdentifiesInvalidProductOptionsXml($xmlString, $expectedError, $isRegex)
5764
{
58-
$this->_loadDataForTest('product_options.xsd', $xmlString, $expectedError);
65+
$this->_loadDataForTest('product_options.xsd', $xmlString, $expectedError, $isRegex);
5966
}
6067

6168
/**

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

Lines changed: 9 additions & 5 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

@@ -12,13 +12,15 @@
1212
"Element 'inputType': This element is not expected. Expected is ( option ).\nLine: 1\n" .
1313
"The xml was: \n0:<?xml version=\"1.0\"?>\n1:<config><inputType name=\"name_one\"/></config>\n2:\n"
1414
],
15+
'isRegex' => false
1516
],
1617
'inputType_node_is_required' => [
1718
'<?xml version="1.0"?><config><option name="name_one"/></config>',
1819
[
1920
"Element 'option': Missing child element(s). Expected is ( inputType ).\nLine: 1\n" .
2021
"The xml was: \n0:<?xml version=\"1.0\"?>\n1:<config><option name=\"name_one\"/></config>\n2:\n"
2122
],
23+
'isRegex' => false
2224
],
2325
'options_name_must_be_unique' => [
2426
'<?xml version="1.0"?><config><option name="name_one"><inputType name="name"/>' .
@@ -29,6 +31,7 @@
2931
"name=\"name_one\"><inputType name=\"name\"/></option><option name=\"name_one\"><inputType " .
3032
"name=\"name_two\"/></option></config>\n2:\n"
3133
],
34+
'isRegex' => false
3235
],
3336
'inputType_name_must_be_unique' => [
3437
'<?xml version="1.0"?><config><option name="name"><inputType name="name_one"/>' .
@@ -39,15 +42,15 @@
3942
"1:<config><option name=\"name\"><inputType name=\"name_one\"/><inputType name=\"name_one\"/>" .
4043
"</option></config>\n2:\n"
4144
],
45+
'isRegex' => false
4246
],
4347
'renderer_attribute_with_invalid_value' => [
4448
'<?xml version="1.0"?><config><option name="name_one" renderer="123true"><inputType name="name_one"/>' .
4549
'</option></config>',
4650
[
47-
"Element 'option', attribute 'renderer': '123true' is not a valid value of the atomic type 'modelName'.\n" .
48-
"Line: 1\nThe xml was: \n0:<?xml version=\"1.0\"?>\n1:<config><option name=\"name_one\" " .
49-
"renderer=\"123true\"><inputType name=\"name_one\"/></option></config>\n2:\n"
51+
"/Element \'option\', attribute \'renderer\': .* (is not a valid value|is not accepted).*/"
5052
],
53+
'isRegex' => true
5154
],
5255
'disabled_attribute_with_invalid_value' => [
5356
'<?xml version="1.0"?><config><option name="name_one"><inputType name="name_one" disabled="7"/>' .
@@ -62,5 +65,6 @@
6265
"<inputType name=\"name_one\" disabled=\"7\"/><inputType name=\"name_two\" disabled=\"some_string\"/>" .
6366
"</option></config>\n2:\n"
6467
],
68+
'isRegex' => false
6569
]
6670
];

0 commit comments

Comments
 (0)