Skip to content

Commit

Permalink
MAGETWO-66795: Fix merging nested <var /> in view.xml #7556
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksii Korshenko authored Apr 11, 2017
2 parents 9e79a47 + a5c13c4 commit 2d24121
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 26 deletions.
2 changes: 1 addition & 1 deletion lib/internal/Magento/Framework/Config/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ protected function getIdAttributes()
{
$idAttributes = [
'/view/vars' => 'module',
'/view/vars/var' => 'name',
'/view/vars/(var/)*var' => 'name',
'/view/exclude/item' => ['type', 'item'],
];
foreach ($this->xpath as $attribute) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@
</config>',
[
"Element 'virtualType', attribute 'name': [facet 'pattern'] The value '' is not accepted by the pattern '" .
"([a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*" .
")*'." .
"(\\\\?[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)" .
"(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)*'." .
"\nLine: 2\n",
"Element 'virtualType', attribute 'name': '' is not a valid value of the atomic type 'phpClassName'." .
"\nLine: 2\n",
Expand All @@ -188,32 +188,14 @@
"\nLine: 2\n",
],
],
'virtualtype with invalid_name' => [
'<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<virtualType name="\\BackslashPrefix\\IsNotAllowed" type="TypeName" shared="true"/>
</config>',
[
"Element 'virtualType', attribute 'name': [facet 'pattern'] The value '\\BackslashPrefix\\IsNotAllowed' " .
"is not accepted by the pattern '" .
"([a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*" .
")*'." .
"\nLine: 2\n",
"Element 'virtualType', attribute 'name': '\\BackslashPrefix\\IsNotAllowed' " .
"is not a valid value of the atomic type 'phpClassName'." .
"\nLine: 2\n",
"Element 'virtualType', attribute 'name': Warning: No precomputed value available, the value was either " .
"invalid or something strange happend." .
"\nLine: 2\n",
],
],
'virtualtype with empty_type' => [
'<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<virtualType name="Name" type="" shared="true"/>
</config>',
[
"Element 'virtualType', attribute 'type': [facet 'pattern'] The value '' is not accepted by the pattern '" .
"([a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*" .
")*'." .
"(\\\\?[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)" .
"(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)*'." .
"\nLine: 2\n",
"Element 'virtualType', attribute 'type': '' is not a valid value of the atomic type 'phpClassName'." .
"\nLine: 2\n",
Expand All @@ -226,8 +208,8 @@
[
"Element 'virtualType', attribute 'name': [facet 'pattern'] The value '777Digits\\IsNotAllowed' " .
"is not accepted by the pattern '" .
"([a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*" .
")*'." .
"(\\\\?[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)" .
"(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)*'." .
"\nLine: 2\n",
"Element 'virtualType', attribute 'name': '777Digits\\IsNotAllowed' " .
"is not a valid value of the atomic type 'phpClassName'." .
Expand All @@ -237,4 +219,22 @@
"\nLine: 2\n",
],
],
'virtualtype with digits_and_prefix_slash' => [
'<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<virtualType name="\\777Digits\\IsNotAllowed" type="TypeName" shared="true"/>
</config>',
[
"Element 'virtualType', attribute 'name': [facet 'pattern'] The value '\\777Digits\\IsNotAllowed' " .
"is not accepted by the pattern '" .
"(\\\\?[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)" .
"(\\\\[a-zA-Z_\x7f-\xc3\xbf][a-zA-Z0-9_\x7f-\xc3\xbf]*)*'." .
"\nLine: 2\n",
"Element 'virtualType', attribute 'name': '\\777Digits\\IsNotAllowed' " .
"is not a valid value of the atomic type 'phpClassName'." .
"\nLine: 2\n",
"Element 'virtualType', attribute 'name': Warning: No precomputed value available, the value was either " .
"invalid or something strange happend." .
"\nLine: 2\n",
],
],
];
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,5 @@
</argument>
</arguments>
</type>
<virtualType name="\BackslashPrefix\IsAllowed" type="TypeName" shared="true"/>
</config>
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:pattern value="([a-zA-Z_&#x7f;-&#xff;][a-zA-Z0-9_&#x7f;-&#xff;]*)(\\[a-zA-Z_&#x7f;-&#xff;][a-zA-Z0-9_&#x7f;-&#xff;]*)*"/>
<xs:pattern value="(\\?[a-zA-Z_&#x7f;-&#xff;][a-zA-Z0-9_&#x7f;-&#xff;]*)(\\[a-zA-Z_&#x7f;-&#xff;][a-zA-Z0-9_&#x7f;-&#xff;]*)*"/>
</xs:restriction>
</xs:simpleType>

Expand Down

0 comments on commit 2d24121

Please sign in to comment.