Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ProductOptionsConfigFilesTest.php
Go to the documentation of this file.
1 <?php
7 
9 
10 class ProductOptionsConfigFilesTest extends \PHPUnit\Framework\TestCase
11 {
15  protected $_model;
16 
17  protected function setUp()
18  {
19  //init primary configs
22  $moduleDirSearch = $objectManager->get(\Magento\Framework\Component\DirSearch::class);
23  $fileIteratorFactory = $objectManager->get(\Magento\Framework\Config\FileIteratorFactory::class);
24  $xmlFiles = $fileIteratorFactory->create(
25  $moduleDirSearch->collectFiles(
27  'etc/{*/product_options.xml,product_options.xml}'
28  )
29  );
30 
31  $fileResolverMock = $this->createMock(\Magento\Framework\Config\FileResolverInterface::class);
32  $fileResolverMock->expects($this->any())->method('get')->will($this->returnValue($xmlFiles));
33  $validationStateMock = $this->createMock(\Magento\Framework\Config\ValidationStateInterface::class);
34  $validationStateMock->expects($this->any())->method('isValidationRequired')->will($this->returnValue(true));
36  $this->_model = $objectManager->create(
37  \Magento\Catalog\Model\ProductOptions\Config\Reader::class,
38  ['fileResolver' => $fileResolverMock, 'validationState' => $validationStateMock]
39  );
40  }
41 
42  public function testProductOptionsXmlFiles()
43  {
44  $this->_model->read('global');
45  }
46 }
$objectManager
Definition: bootstrap.php:17