Skip to content

Commit 4c19ad9

Browse files
author
Oleksii Korshenko
committed
MAGETWO-52792: ACL node title stated as optional in xsd but required in logic
- fixed unit tests
1 parent 2008e88 commit 4c19ad9

File tree

2 files changed

+26
-13
lines changed

2 files changed

+26
-13
lines changed

lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/Config/SchemaLocatorTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ public function testGetSchema()
1414
$urnResolverMock = $this->getMock('Magento\Framework\Config\Dom\UrnResolver', [], [], '', false);
1515
$urnResolverMock->expects($this->once())
1616
->method('getRealPath')
17-
->with('urn:magento:framework:Acl/etc/acl.xsd')
18-
->willReturn($urnResolver->getRealPath('urn:magento:framework:Acl/etc/acl.xsd'));
17+
->with('urn:magento:framework:Acl/etc/acl_merged.xsd')
18+
->willReturn($urnResolver->getRealPath('urn:magento:framework:Acl/etc/acl_merged.xsd'));
1919
$schemaLocator = new \Magento\Framework\Acl\AclResource\Config\SchemaLocator($urnResolverMock);
2020
$this->assertEquals(
21-
$urnResolver->getRealPath('urn:magento:framework:Acl/etc/acl.xsd'),
21+
$urnResolver->getRealPath('urn:magento:framework:Acl/etc/acl_merged.xsd'),
2222
$schemaLocator->getSchema()
2323
);
2424
}

lib/internal/Magento/Framework/Acl/Test/Unit/AclResource/Config/_files/invalidAclXmlArray.php

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@
99
'disabled=""/></resources></acl></config>',
1010
[
1111
"Element 'resource', attribute 'disabled': '' is not a valid value of the atomic" .
12-
" type 'xs:boolean'.\nLine: 1\n"],
12+
" type 'xs:boolean'.\nLine: 1\n",
13+
"Element 'resource': The attribute 'title' is required but missing.\nLine: 1\n",
14+
],
1315
],
1416
'disabled_attribute_wrong_type_value' => [
1517
'<?xml version="1.0"?><config><acl><resources><resource id="Test_Value::show_toolbar" ' .
1618
'disabled="notBool"/></resources></acl></config>',
1719
[
1820
"Element 'resource', attribute 'disabled': 'notBool' is not a valid value of the atomic type " .
19-
"'xs:boolean'.\nLine: 1\n"
21+
"'xs:boolean'.\nLine: 1\n",
22+
"Element 'resource': The attribute 'title' is required but missing.\nLine: 1\n",
2023
],
2124
],
2225
'double_acl' => [
@@ -59,7 +62,8 @@
5962
"'typeId'.\nLine: 1\n",
6063
"Element 'resource', attribute 'id': Warning: No precomputed value available, " .
6164
"the value was either invalid or " .
62-
"something strange happend.\nLine: 1\n"
65+
"something strange happend.\nLine: 1\n",
66+
"Element 'resource': The attribute 'title' is required but missing.\nLine: 1\n",
6367
],
6468
],
6569
'notvalid_id_attribute_value_regexp2' => [
@@ -71,7 +75,8 @@
7175
"Element 'resource', attribute 'id': 'Test_value::show_toolbar' is not a valid value of the atomic type " .
7276
"'typeId'.\nLine: 1\n",
7377
"Element 'resource', attribute 'id': Warning: No precomputed value available, " .
74-
"the value was either invalid or something strange happend.\nLine: 1\n"
78+
"the value was either invalid or something strange happend.\nLine: 1\n",
79+
"Element 'resource': The attribute 'title' is required but missing.\nLine: 1\n",
7580
],
7681
],
7782
'notvalid_id_attribute_value_regexp3' => [
@@ -83,7 +88,8 @@
8388
"Element 'resource', attribute 'id': 'M@#$%^*_Value::show_toolbar' " .
8489
"is not a valid value of the atomic type 'typeId'.\nLine: 1\n",
8590
"Element 'resource', attribute 'id': Warning: No precomputed value available, " .
86-
"the value was either invalid or something strange happend.\nLine: 1\n"
91+
"the value was either invalid or something strange happend.\nLine: 1\n",
92+
"Element 'resource': The attribute 'title' is required but missing.\nLine: 1\n",
8793
],
8894
],
8995
'notvalid_id_attribute_value_regexp4' => [
@@ -96,7 +102,8 @@
96102
"is not a valid value of the atomic type 'typeId'.\nLine: 1\n",
97103
"Element 'resource', attribute 'id': " .
98104
"Warning: No precomputed value available, the value was either invalid " .
99-
"or something strange happend.\nLine: 1\n"
105+
"or something strange happend.\nLine: 1\n",
106+
"Element 'resource': The attribute 'title' is required but missing.\nLine: 1\n",
100107
],
101108
],
102109
'notvalid_id_attribute_value_regexp5' => [
@@ -109,7 +116,8 @@
109116
"is not a valid value of the atomic type 'typeId'.\nLine: 1\n",
110117
"Element 'resource', attribute 'id': " .
111118
"Warning: No precomputed value available, the value was either invalid " .
112-
"or something strange happend.\nLine: 1\n"
119+
"or something strange happend.\nLine: 1\n",
120+
"Element 'resource': The attribute 'title' is required but missing.\nLine: 1\n",
113121
],
114122
],
115123
'notvalid_id_attribute_value_regexp6' => [
@@ -122,7 +130,8 @@
122130
"type 'typeId'.\nLine: 1\n",
123131
"Element 'resource', attribute 'id': " .
124132
"Warning: No precomputed value available, the value was either invalid " .
125-
"or something strange happend.\nLine: 1\n"
133+
"or something strange happend.\nLine: 1\n",
134+
"Element 'resource': The attribute 'title' is required but missing.\nLine: 1\n",
126135
],
127136
],
128137
'notvalid_id_attribute_value_regexp7' => [
@@ -134,7 +143,8 @@
134143
" 'typeId'.\nLine: 1\n",
135144
"Element 'resource', attribute 'id': " .
136145
"Warning: No precomputed value available, the value was either invalid " .
137-
"or something strange happend.\nLine: 1\n"
146+
"or something strange happend.\nLine: 1\n",
147+
"Element 'resource': The attribute 'title' is required but missing.\nLine: 1\n",
138148
],
139149
],
140150
'sortOrder_attribute_empty_value' => [
@@ -153,7 +163,10 @@
153163
'with_not_allowed_attribute' => [
154164
'<?xml version="1.0"?><config><acl><resources><resource id="Test_Value::show_toolbar" ' .
155165
'someatrrname="some value"/></resources></acl></config>',
156-
["Element 'resource', attribute 'someatrrname': The attribute 'someatrrname' is not allowed.\nLine: 1\n"],
166+
[
167+
"Element 'resource', attribute 'someatrrname': The attribute 'someatrrname' is not allowed.\nLine: 1\n",
168+
"Element 'resource': The attribute 'title' is required but missing.\nLine: 1\n",
169+
],
157170
],
158171
'with_two_same_id' => [
159172
'<?xml version="1.0"?><config><acl><resources><resource id="Test_Value::show_toolbar" ' .

0 commit comments

Comments
 (0)