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 3535 'match_query ' => [
3636 'value ' => '$match_term_override$ ' ,
3737 'name ' => 'match_query ' ,
38+ 'boost ' => '1 ' ,
3839 'match ' => [
3940 0 => [
4041 'field ' => 'match_field ' ,
5051 ],
5152 'must_query ' => [
5253 'name ' => 'must_query ' ,
54+ 'boost ' => '1 ' ,
5355 'filterReference ' => [
5456 0 => [
5557 'clause ' => 'must ' ,
6062 ],
6163 'should_query ' => [
6264 'name ' => 'should_query ' ,
65+ 'boost ' => '1 ' ,
6366 'filterReference ' => [
6467 0 => [
6568 'clause ' => 'should ' ,
7073 ],
7174 'not_query ' => [
7275 'name ' => 'not_query ' ,
76+ 'boost ' => '1 ' ,
7377 'filterReference ' => [
7478 0 => [
7579 'clause ' => 'not ' ,
8084 ],
8185 'match_query_2 ' => [
8286 'value ' => '$match_term_override$ ' ,
87+ 'boost ' => '1 ' ,
8388 'name ' => 'match_query_2 ' ,
8489 'match ' => [
8590 0 => [
163168 'queries ' => [
164169 'filter_query ' => [
165170 'name ' => 'filter_query ' ,
171+ 'boost ' => '1 ' ,
166172 'filterReference ' => [
167173 0 =>
168174 [
230236 'new_match_query ' => [
231237 'value ' => '$match_term$ ' ,
232238 'name ' => 'new_match_query ' ,
239+ 'boost ' => '1 ' ,
233240 'match ' => [
234241 0 =>
235242 [
Original file line number Diff line number Diff line change @@ -318,7 +318,7 @@ public static function validateDomDocument(
318318 libxml_set_external_entity_loader ([self ::$ urnResolver , 'registerEntityLoader ' ]);
319319 $ errors = [];
320320 try {
321- $ result = $ dom ->schemaValidate ($ schema );
321+ $ result = $ dom ->schemaValidate ($ schema, LIBXML_SCHEMA_CREATE );
322322 if (!$ result ) {
323323 $ errors = self ::getXmlErrors ($ errorFormat );
324324 }
Original file line number Diff line number Diff line change @@ -135,6 +135,48 @@ public function validateDataProvider()
135135 ];
136136 }
137137
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+
138180 public function testValidateCustomErrorFormat ()
139181 {
140182 $ xml = '<root><unknown_node/></root> ' ;
Original file line number Diff line number Diff line change 2121 <xs : simpleContent >
2222 <xs : extension base =" xs:string" >
2323 <xs : attribute name =" id" type =" xs:string" use =" required" />
24+ <xs : attribute name =" attribute_with_default_value" type =" xs:string" default =" default_value" />
2425 </xs : extension >
2526 </xs : simpleContent >
2627 </xs : complexType >
You can’t perform that action at this time.
0 commit comments