1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Test\Integrity\Modular;
use Magento\Framework\Component\ComponentRegistrar;
class EavAttributesConfigFilesTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Eav\Model\Entity\Attribute\Config\Reader
*/
protected $_model;
public function setUp()
{
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
/** @var $moduleDirSearch \Magento\Framework\Component\DirSearch */
$moduleDirSearch = $objectManager->get(\Magento\Framework\Component\DirSearch::class);
$fileIteratorFactory = $objectManager->get(\Magento\Framework\Config\FileIteratorFactory::class);
$xmlFiles = $fileIteratorFactory->create(
$moduleDirSearch->collectFiles(ComponentRegistrar::MODULE, 'etc/{*/eav_attributes.xml,eav_attributes.xml}')
);
$validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
$validationStateMock->expects($this->any())->method('isValidationRequired')->will($this->returnValue(true));
$fileResolverMock = $this->createMock(\Magento\Framework\Config\FileResolverInterface::class);
$fileResolverMock->expects($this->any())->method('get')->will($this->returnValue($xmlFiles));
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
$this->_model = $objectManager->create(
\Magento\Eav\Model\Entity\Attribute\Config\Reader::class,
['fileResolver' => $fileResolverMock, 'validationState' => $validationStateMock]
);
}
public function testImportXmlFiles()
{
$this->_model->read('global');
}
}