public function testGetDesign()
 {
     $expected = new \StdClass();
     $this->componentDirSearch->expects($this->once())->method('collectFiles')->with(ComponentRegistrar::THEME, 'etc/file')->will($this->returnValue(['test']));
     $this->factory->expects($this->once())->method('create')->with(['test'])->willReturn($expected);
     $this->assertSame($expected, $this->object->get('file', 'design'));
 }
Exemplo n.º 2
0
 public function testGetLayoutConfigFiles()
 {
     $this->dirSearch->expects($this->once())->method('collectFiles')->with(ComponentRegistrar::THEME, '/etc/some.file')->willReturn(['/one/some.file', '/two/some.file']);
     $expected = ['/one/some.file', '/two/some.file'];
     $actual = Files::init()->getLayoutConfigFiles('some.file', false);
     $this->assertSame($expected, $actual);
     // Check that the result is cached (collectFiles() is called only once)
     $this->assertSame($expected, $actual);
 }
Exemplo n.º 3
0
 public function testGetFiles()
 {
     $files = [];
     foreach (['shared', 'theme'] as $fileType) {
         for ($i = 0; $i < 2; $i++) {
             $file = $this->getMock('\\Magento\\Framework\\Component\\ComponentFile', [], [], '', false);
             $file->expects($this->once())->method('getFullPath')->will($this->returnValue("{$fileType}/module/{$i}/path"));
             $file->expects($this->once())->method('getComponentName')->will($this->returnValue('Module_' . $i));
             $files[$fileType][] = $file;
         }
     }
     $this->dirSearch->expects($this->any())->method('collectFilesWithContext')->willReturnMap([[ComponentRegistrar::MODULE, 'view/base/layout/*.xml', $files['shared']], [ComponentRegistrar::MODULE, 'view/frontend/layout/*.xml', $files['theme']]]);
     $this->fileFactoryMock->expects($this->atLeastOnce())->method('create')->willReturn($this->createFileMock());
     $this->themeMock->expects($this->once())->method('getData')->with('area')->willReturn('frontend');
     $result = $this->fileCollector->getFiles($this->themeMock, '*.xml');
     $this->assertCount(4, $result);
     $this->assertInstanceOf('Magento\\Framework\\View\\File', $result[0]);
     $this->assertInstanceOf('Magento\\Framework\\View\\File', $result[1]);
     $this->assertInstanceOf('Magento\\Framework\\View\\File', $result[2]);
     $this->assertInstanceOf('Magento\\Framework\\View\\File', $result[3]);
 }