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