Skip to content

Commit

Permalink
ENGCOM-4065: 14882 product types xml doesn t allow numbers in model i…
Browse files Browse the repository at this point in the history
…nstance #20617
  • Loading branch information
sidolov authored Feb 19, 2019
2 parents ae7f574 + 86414f6 commit 2eb9b72
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
],
],
'renderer_attribute_with_invalid_value' => [
'<?xml version="1.0"?><config><option name="name_one" renderer="true12"><inputType name="name_one"/>' .
'<?xml version="1.0"?><config><option name="name_one" renderer="123true"><inputType name="name_one"/>' .
'</option></config>',
[
"Element 'option', attribute 'renderer': [facet 'pattern'] The value 'true12' is not accepted by the " .
"pattern '[a-zA-Z_\\\\]+'.\nLine: 1\n",
"Element 'option', attribute 'renderer': 'true12' is not a valid value of the atomic" .
"Element 'option', attribute 'renderer': [facet 'pattern'] The value '123true' is not accepted by the " .
"pattern '([\\\\]?[a-zA-Z_][a-zA-Z0-9_]*)+'.\nLine: 1\n",
"Element 'option', attribute 'renderer': '123true' is not a valid value of the atomic" .
" type 'modelName'.\nLine: 1\n"
],
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
'<?xml version="1.0"?><config><type name="some_name" modelInstance="123" /></config>',
[
"Element 'type', attribute 'modelInstance': [facet 'pattern'] The value '123' is not accepted by the" .
" pattern '[a-zA-Z_\\\\]+'.\nLine: 1\n",
" pattern '([\\\\]?[a-zA-Z_][a-zA-Z0-9_]*)+'.\nLine: 1\n",
"Element 'type', attribute 'modelInstance': '123' is not a valid value of the atomic type" .
" 'modelName'.\nLine: 1\n"
],
Expand Down Expand Up @@ -57,7 +57,7 @@
'<?xml version="1.0"?><config><type name="some_name"><priceModel instance="123123" /></type></config>',
[
"Element 'priceModel', attribute 'instance': [facet 'pattern'] The value '123123' is not accepted " .
"by the pattern '[a-zA-Z_\\\\]+'.\nLine: 1\n",
"by the pattern '([\\\\]?[a-zA-Z_][a-zA-Z0-9_]*)+'.\nLine: 1\n",
"Element 'priceModel', attribute 'instance': '123123' is not a valid value of the atomic type" .
" 'modelName'.\nLine: 1\n"
],
Expand All @@ -66,7 +66,7 @@
'<?xml version="1.0"?><config><type name="some_name"><indexerModel instance="123" /></type></config>',
[
"Element 'indexerModel', attribute 'instance': [facet 'pattern'] The value '123' is not accepted by " .
"the pattern '[a-zA-Z_\\\\]+'.\nLine: 1\n",
"the pattern '([\\\\]?[a-zA-Z_][a-zA-Z0-9_]*)+'.\nLine: 1\n",
"Element 'indexerModel', attribute 'instance': '123' is not a valid value of the atomic type" .
" 'modelName'.\nLine: 1\n"
],
Expand All @@ -83,7 +83,7 @@
'<?xml version="1.0"?><config><type name="some_name"><stockIndexerModel instance="1234"/></type></config>',
[
"Element 'stockIndexerModel', attribute 'instance': [facet 'pattern'] The value '1234' is not " .
"accepted by the pattern '[a-zA-Z_\\\\]+'.\nLine: 1\n",
"accepted by the pattern '([\\\\]?[a-zA-Z_][a-zA-Z0-9_]*)+'.\nLine: 1\n",
"Element 'stockIndexerModel', attribute 'instance': '1234' is not a valid value of the atomic " .
"type 'modelName'.\nLine: 1\n"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
<stockIndexerModel instance="instance_name"/>
</type>
<type label="some_label" name="some_name2" modelInstance="model_name">
<allowedSelectionTypes>
<type name="some_name" />
</allowedSelectionTypes>
<priceModel instance="instance_name_with_digits_123" />
<indexerModel instance="instance_name_with_digits_123" />
<stockIndexerModel instance="instance_name_with_digits_123"/>
</type>
<type label="some_label" name="some_name3" modelInstance="model_name">
<allowedSelectionTypes>
<type name="some_name" />
</allowedSelectionTypes>
Expand All @@ -25,5 +33,6 @@
<composableTypes>
<type name="some_name"/>
<type name="some_name2"/>
<type name="some_name3"/>
</composableTypes>
</config>
4 changes: 2 additions & 2 deletions app/code/Magento/Catalog/etc/product_options.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@
<xs:simpleType name="modelName">
<xs:annotation>
<xs:documentation>
Model name can contain only [a-zA-Z_\\].
Model name can contain only ([\\]?[a-zA-Z_][a-zA-Z0-9_]*)+.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:pattern value="[a-zA-Z_\\]+" />
<xs:pattern value="([\\]?[a-zA-Z_][a-zA-Z0-9_]*)+" />
</xs:restriction>
</xs:simpleType>
</xs:schema>
4 changes: 2 additions & 2 deletions app/code/Magento/Catalog/etc/product_types_base.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@
<xs:simpleType name="modelName">
<xs:annotation>
<xs:documentation>
Model name can contain only [a-zA-Z_\\].
Model name can contain only ([\\]?[a-zA-Z_][a-zA-Z0-9_]*)+.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:pattern value="[a-zA-Z_\\]+" />
<xs:pattern value="([\\]?[a-zA-Z_][a-zA-Z0-9_]*)+" />
</xs:restriction>
</xs:simpleType>
</xs:schema>
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
'attributes_with_type_modelName_and_invalid_value' => [
'<?xml version="1.0"?><config><entity name="Name/one" model="model_one" '
. 'entityAttributeFilterType="model_one"/><entityType entity="Name/one" name="name_one" model="1"/>'
. ' <fileFormat name="name_one" model="model1"/></config>',
. ' <fileFormat name="name_one" model="1model"/></config>',
[
"Element 'entityType', attribute 'model': [facet 'pattern'] The value '1' is not accepted by the " .
"pattern '[A-Za-z_\\\\]+'.\nLine: 1\n",
"pattern '([\\\\]?[a-zA-Z_][a-zA-Z0-9_]*)+'.\nLine: 1\n",
"Element 'entityType', attribute 'model': '1' is not a valid value of the atomic type" .
" 'modelName'.\nLine: 1\n",
"Element 'fileFormat', attribute 'model': [facet 'pattern'] The value 'model1' is not " .
"accepted by the pattern '[A-Za-z_\\\\]+'.\nLine: 1\n",
"Element 'fileFormat', attribute 'model': 'model1' is not a valid " .
"Element 'fileFormat', attribute 'model': [facet 'pattern'] The value '1model' is not " .
"accepted by the pattern '([\\\\]?[a-zA-Z_][a-zA-Z0-9_]*)+'.\nLine: 1\n",
"Element 'fileFormat', attribute 'model': '1model' is not a valid " .
"value of the atomic type 'modelName'.\nLine: 1\n"
],
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
["Element 'entity', attribute 'notallowed': The attribute 'notallowed' is not allowed.\nLine: 1\n"],
],
'entity_model_with_invalid_value' => [
'<?xml version="1.0"?><config><entity name="test_name" label="test_label" model="afwer34" ' .
'<?xml version="1.0"?><config><entity name="test_name" label="test_label" model="34afwer" ' .
'behaviorModel="test" /></config>',
[
"Element 'entity', attribute 'model': [facet 'pattern'] The value 'afwer34' is not " .
"accepted by the pattern '[A-Za-z_\\\\]+'.\nLine: 1\n",
"Element 'entity', attribute 'model': 'afwer34' is not a valid value of the atomic type" .
"Element 'entity', attribute 'model': [facet 'pattern'] The value '34afwer' is not " .
"accepted by the pattern '([\\\\]?[a-zA-Z_][a-zA-Z0-9_]*)+'.\nLine: 1\n",
"Element 'entity', attribute 'model': '34afwer' is not a valid value of the atomic type" .
" 'modelName'.\nLine: 1\n"
],
],
Expand All @@ -40,7 +40,7 @@
'</config>',
[
"Element 'entity', attribute 'behaviorModel': [facet 'pattern'] The value '666' is not accepted by " .
"the pattern '[A-Za-z_\\\\]+'.\nLine: 1\n",
"the pattern '([\\\\]?[a-zA-Z_][a-zA-Z0-9_]*)+'.\nLine: 1\n",
"Element 'entity', attribute 'behaviorModel': '666' is not a valid value of the atomic type" .
" 'modelName'.\nLine: 1\n"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
'<?xml version="1.0"?><config><entity name="some_name" model="12345"/></config>',
[
"Element 'entity', attribute 'model': [facet 'pattern'] The value '12345' is not accepted by " .
"the pattern '[A-Za-z_\\\\]+'.\nLine: 1\n",
"the pattern '([\\\\]?[a-zA-Z_][a-zA-Z0-9_]*)+'.\nLine: 1\n",
"Element 'entity', attribute 'model': '12345' is not a valid value of the atomic type" .
" 'modelName'.\nLine: 1\n"
],
Expand All @@ -28,7 +28,7 @@
'<?xml version="1.0"?><config><entity name="some_name" behaviorModel="=--09"/></config>',
[
"Element 'entity', attribute 'behaviorModel': [facet 'pattern'] The value '=--09' is not " .
"accepted by the pattern '[A-Za-z_\\\\]+'.\nLine: 1\n",
"accepted by the pattern '([\\\\]?[a-zA-Z_][a-zA-Z0-9_]*)+'.\nLine: 1\n",
"Element 'entity', attribute 'behaviorModel': '=--09' is not a valid value of the atomic type" .
" 'modelName'.\nLine: 1\n"
],
Expand All @@ -46,11 +46,11 @@
["Element 'entityType': The attribute 'model' is required but missing.\nLine: 1\n"],
],
'entitytype_with_invalid_model_attribute_value' => [
'<?xml version="1.0"?><config><entityType entity="entity_name" name="some_name" model="test1"/></config>',
'<?xml version="1.0"?><config><entityType entity="entity_name" name="some_name" model="1test"/></config>',
[
"Element 'entityType', attribute 'model': [facet 'pattern'] The value 'test1' is not " .
"accepted by the pattern '[A-Za-z_\\\\]+'.\nLine: 1\n",
"Element 'entityType', attribute 'model': 'test1' is not a valid value of the atomic type" .
"Element 'entityType', attribute 'model': [facet 'pattern'] The value '1test' is not " .
"accepted by the pattern '([\\\\]?[a-zA-Z_][a-zA-Z0-9_]*)+'.\nLine: 1\n",
"Element 'entityType', attribute 'model': '1test' is not a valid value of the atomic type" .
" 'modelName'.\nLine: 1\n"
],
],
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/ImportExport/etc/export.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@
<xs:simpleType name="modelName">
<xs:annotation>
<xs:documentation>
Model name can contain only [A-Za-z_\\].
Model name can contain only ([\\]?[a-zA-Z_][a-zA-Z0-9_]*)+.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:pattern value="[A-Za-z_\\]+" />
<xs:pattern value="([\\]?[a-zA-Z_][a-zA-Z0-9_]*)+" />
</xs:restriction>
</xs:simpleType>
</xs:schema>
4 changes: 2 additions & 2 deletions app/code/Magento/ImportExport/etc/import.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@
<xs:simpleType name="modelName">
<xs:annotation>
<xs:documentation>
Model name can contain only [A-Za-z_\\].
Model name can contain only ([\\]?[a-zA-Z_][a-zA-Z0-9_]*)+.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:pattern value="[A-Za-z_\\]+" />
<xs:pattern value="([\\]?[a-zA-Z_][a-zA-Z0-9_]*)+" />
</xs:restriction>
</xs:simpleType>
</xs:schema>

0 comments on commit 2eb9b72

Please sign in to comment.