Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
FilesCollectorTest.php
Go to the documentation of this file.
1 <?php
7 
8 class FilesCollectorTest extends \PHPUnit\Framework\TestCase
9 {
13  protected $_testDir;
14 
18  protected $_filesCollector;
19 
20  protected function setUp()
21  {
22  $this->_testDir = str_replace('\\', '/', realpath(dirname(__FILE__))) . '/_files/files_collector/';
23 
24  $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
25  $this->_filesCollector = $objectManagerHelper->getObject(\Magento\Setup\Module\I18n\FilesCollector::class);
26  }
27 
28  public function testGetFilesWithoutMask()
29  {
30  $expectedResult = [$this->_testDir . 'default.xml', $this->_testDir . 'file.js'];
31  $files = $this->_filesCollector->getFiles([$this->_testDir]);
32  $this->assertEquals($expectedResult, $files);
33  }
34 
35  public function testGetFilesWithMask()
36  {
37  $expectedResult = [$this->_testDir . 'file.js'];
38  $this->assertEquals($expectedResult, $this->_filesCollector->getFiles([$this->_testDir], '/\.js$/'));
39  }
40 }
defined('MTF_BOOT_FILE')||define('MTF_BOOT_FILE' __FILE__
Definition: bootstrap.php:7
foreach($appDirs as $dir) $files