File tree Expand file tree Collapse file tree 4 files changed +51
-1
lines changed
dev/tests/integration/testsuite/Magento/Framework/Search/_files
lib/internal/Magento/Framework/Config Expand file tree Collapse file tree 4 files changed +51
-1
lines changed Original file line number Diff line number Diff line change 35
35
'match_query ' => [
36
36
'value ' => '$match_term_override$ ' ,
37
37
'name ' => 'match_query ' ,
38
+ 'boost ' => '1 ' ,
38
39
'match ' => [
39
40
0 => [
40
41
'field ' => 'match_field ' ,
50
51
],
51
52
'must_query ' => [
52
53
'name ' => 'must_query ' ,
54
+ 'boost ' => '1 ' ,
53
55
'filterReference ' => [
54
56
0 => [
55
57
'clause ' => 'must ' ,
60
62
],
61
63
'should_query ' => [
62
64
'name ' => 'should_query ' ,
65
+ 'boost ' => '1 ' ,
63
66
'filterReference ' => [
64
67
0 => [
65
68
'clause ' => 'should ' ,
70
73
],
71
74
'not_query ' => [
72
75
'name ' => 'not_query ' ,
76
+ 'boost ' => '1 ' ,
73
77
'filterReference ' => [
74
78
0 => [
75
79
'clause ' => 'not ' ,
80
84
],
81
85
'match_query_2 ' => [
82
86
'value ' => '$match_term_override$ ' ,
87
+ 'boost ' => '1 ' ,
83
88
'name ' => 'match_query_2 ' ,
84
89
'match ' => [
85
90
0 => [
163
168
'queries ' => [
164
169
'filter_query ' => [
165
170
'name ' => 'filter_query ' ,
171
+ 'boost ' => '1 ' ,
166
172
'filterReference ' => [
167
173
0 =>
168
174
[
230
236
'new_match_query ' => [
231
237
'value ' => '$match_term$ ' ,
232
238
'name ' => 'new_match_query ' ,
239
+ 'boost ' => '1 ' ,
233
240
'match ' => [
234
241
0 =>
235
242
[
Original file line number Diff line number Diff line change @@ -318,7 +318,7 @@ public static function validateDomDocument(
318
318
libxml_set_external_entity_loader ([self ::$ urnResolver , 'registerEntityLoader ' ]);
319
319
$ errors = [];
320
320
try {
321
- $ result = $ dom ->schemaValidate ($ schema );
321
+ $ result = $ dom ->schemaValidate ($ schema, LIBXML_SCHEMA_CREATE );
322
322
if (!$ result ) {
323
323
$ errors = self ::getXmlErrors ($ errorFormat );
324
324
}
Original file line number Diff line number Diff line change @@ -135,6 +135,48 @@ public function validateDataProvider()
135
135
];
136
136
}
137
137
138
+ /**
139
+ * @param string $xml
140
+ * @param string $expectedValue
141
+ * @dataProvider validateWithDefaultValueDataProvider
142
+ */
143
+ public function testValidateWithDefaultValue ($ xml , $ expectedValue )
144
+ {
145
+ if (!function_exists ('libxml_set_external_entity_loader ' )) {
146
+ $ this ->markTestSkipped ('Skipped on HHVM. Will be fixed in MAGETWO-45033 ' );
147
+ }
148
+
149
+ $ actualErrors = [];
150
+
151
+ $ dom = new \Magento \Framework \Config \Dom ($ xml , $ this ->validationStateMock );
152
+ $ dom ->validate (__DIR__ . '/_files/sample.xsd ' , $ actualErrors );
153
+
154
+ $ actualValue = $ dom ->getDom ()
155
+ ->getElementsByTagName ('root ' )->item (0 )
156
+ ->getElementsByTagName ('node ' )->item (0 )
157
+ ->getAttribute ('attribute_with_default_value ' );
158
+
159
+ $ this ->assertEmpty ($ actualErrors );
160
+ $ this ->assertEquals ($ expectedValue , $ actualValue );
161
+ }
162
+
163
+ /**
164
+ * @return array
165
+ */
166
+ public function validateWithDefaultValueDataProvider ()
167
+ {
168
+ return [
169
+ 'default_value ' => [
170
+ '<root><node id="id1"/></root> ' ,
171
+ 'default_value '
172
+ ],
173
+ 'custom_value ' => [
174
+ '<root><node id="id1" attribute_with_default_value="non_default_value"/></root> ' ,
175
+ 'non_default_value '
176
+ ],
177
+ ];
178
+ }
179
+
138
180
public function testValidateCustomErrorFormat ()
139
181
{
140
182
$ xml = '<root><unknown_node/></root> ' ;
Original file line number Diff line number Diff line change 21
21
<xs : simpleContent >
22
22
<xs : extension base =" xs:string" >
23
23
<xs : attribute name =" id" type =" xs:string" use =" required" />
24
+ <xs : attribute name =" attribute_with_default_value" type =" xs:string" default =" default_value" />
24
25
</xs : extension >
25
26
</xs : simpleContent >
26
27
</xs : complexType >
You can’t perform that action at this time.
0 commit comments