Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ModuleOutputTest.php
Go to the documentation of this file.
1 <?php
8 
9 class ModuleOutputTest extends \PHPUnit\Framework\TestCase
10 {
14  private $_model;
15 
19  private $_fileSource;
20 
24  private $_moduleManager;
25 
26  protected function setUp()
27  {
28  $this->_fileSource = $this->getMockForAbstractClass(\Magento\Framework\View\File\CollectorInterface::class);
29  $this->_moduleManager = $this->createMock(\Magento\Framework\Module\Manager::class);
30  $this->_moduleManager
31  ->expects($this->any())
32  ->method('isOutputEnabled')
33  ->will($this->returnValueMap([
34  ['Module_OutputEnabled', true],
35  ['Module_OutputDisabled', false],
36  ]));
37  $this->_model = new \Magento\Framework\View\File\Collector\Decorator\ModuleOutput(
38  $this->_fileSource,
39  $this->_moduleManager
40  );
41  }
42 
43  public function testGetFiles()
44  {
45  $theme = $this->getMockForAbstractClass(\Magento\Framework\View\Design\ThemeInterface::class);
46  $fileOne = new \Magento\Framework\View\File('1.xml', 'Module_OutputEnabled');
47  $fileTwo = new \Magento\Framework\View\File('2.xml', 'Module_OutputDisabled');
48  $fileThree = new \Magento\Framework\View\File('3.xml', 'Module_OutputEnabled', $theme);
49  $this->_fileSource
50  ->expects($this->once())
51  ->method('getFiles')
52  ->with($theme, '*.xml')
53  ->will($this->returnValue([$fileOne, $fileTwo, $fileThree]));
54  $this->assertSame([$fileOne, $fileThree], $this->_model->getFiles($theme, '*.xml'));
55  }
56 }
$theme