Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AttributeConfigFilesTest.php
Go to the documentation of this file.
1 <?php
7 
8 class AttributeConfigFilesTest extends \PHPUnit\Framework\TestCase
9 {
13  protected $_schemaFile;
14 
15  protected function setUp()
16  {
19  $schemaLocator = $objectManager->get(\Magento\Catalog\Model\Attribute\Config\SchemaLocator::class);
20  $this->_schemaFile = $schemaLocator->getSchema();
21  }
22 
27  public function testFileFormat($file)
28  {
29  $validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
30  $validationStateMock->method('isValidationRequired')
31  ->willReturn(true);
32  $dom = new \Magento\Framework\Config\Dom(file_get_contents($file), $validationStateMock);
33  $result = $dom->validate($this->_schemaFile, $errors);
34  $this->assertTrue($result, print_r($errors, true));
35  }
36 
40  public function fileFormatDataProvider()
41  {
42  return \Magento\Framework\App\Utility\Files::init()->getConfigFiles('catalog_attributes.xml');
43  }
44 }
$objectManager
Definition: bootstrap.php:17
$errors
Definition: overview.phtml:9