Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
PrimaryTest.php
Go to the documentation of this file.
1 <?php
7 
9 
10 class PrimaryTest extends \PHPUnit\Framework\TestCase
11 {
18  public function testGet(array $fileList, $scope, $filename)
19  {
20  $directory = $this->createMock(\Magento\Framework\Filesystem\Directory\Read::class);
21  $filesystem = $this->createMock(\Magento\Framework\Filesystem::class);
22  $iteratorFactory = $this->createPartialMock(\Magento\Framework\Config\FileIteratorFactory::class, ['create']);
23 
24  $filesystem->expects(
25  $this->once()
26  )->method(
27  'getDirectoryRead'
28  )->with(
30  )->will(
31  $this->returnValue($directory)
32  );
33 
34  $directory->expects($this->once())->method('search')->will($this->returnValue($fileList));
35 
36  $iteratorFactory->expects($this->once())->method('create')->will($this->returnValue(true));
37 
38  $model = new \Magento\Framework\App\Arguments\FileResolver\Primary($filesystem, $iteratorFactory);
39 
40  $this->assertTrue($model->get($filename, $scope));
41  }
42 
46  public function getMethodDataProvider()
47  {
48  return [[['config/di.xml', 'config/some_config/di.xml'], 'primary', 'di.xml']];
49  }
50 }
$fileList
Definition: export.php:13
$filesystem