Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SearchEngineConfigTest.php
Go to the documentation of this file.
1 <?php
9 
11 {
13  protected $urnResolver;
14 
15  protected function setUp()
16  {
17  $this->urnResolver = new \Magento\Framework\Config\Dom\UrnResolver();
18  }
19 
25  protected function _getXsd()
26  {
27  return $this->urnResolver->getRealPath('urn:magento:framework:Search/etc/search_engine.xsd');
28  }
29 
35  protected function _getFileXsd()
36  {
37  return $this->urnResolver->getRealPath('urn:magento:framework:Search/etc/search_engine.xsd');
38  }
39 
45  protected function _getKnownValidXml()
46  {
47  return __DIR__ . '/_files/search_engine/valid.xml';
48  }
49 
55  protected function _getKnownInvalidXml()
56  {
57  return __DIR__ . '/_files/search_engine/invalid.xml';
58  }
59 
65  protected function _getKnownValidPartialXml()
66  {
67  return null;
68  }
69 
73  public function testSchemaUsingInvalidXml($expectedErrors = null)
74  {
75  $expectedErrors = array_filter(
76  explode(
77  "\n",
78  "
79 Element 'feature': The attribute 'support' is required but missing.
80 Element 'wrong': This element is not expected. Expected is ( feature ).
81 Element 'feature': The attribute 'name' is required but missing.
82 Element 'engine', attribute 'wrong': The attribute 'wrong' is not allowed.
83 Element 'engine': The attribute 'name' is required but missing.
84 Element 'feature', attribute 'support': 'wrong' is not a valid value of the atomic type 'xs:boolean'.
85 "
86  )
87  );
88  parent::testSchemaUsingInvalidXml($expectedErrors);
89  }
90 
96  protected function _getXmlName()
97  {
98  return 'search_engine.xml';
99  }
100 
106  protected function _getKnownInvalidPartialXml()
107  {
108  return null;
109  }
110 
111  public function testSchemaUsingValidXml()
112  {
113  parent::testSchemaUsingValidXml();
114  }
115 }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60