protected function setUp()
 {
     $this->notationResolver = $this->getMock('\\Magento\\Framework\\View\\Asset\\NotationResolver\\Module', [], [], '', false);
     $this->asset = $this->getMock('\\Magento\\Framework\\View\\Asset\\File', [], [], '', false);
     $this->asset->expects($this->any())->method('getContentType')->will($this->returnValue('css'));
     $this->object = new \Magento\Framework\Css\PreProcessor\Instruction\Import($this->notationResolver);
 }
 protected function setUp()
 {
     $this->notationResolver = $this->getMock('\\Magento\\Framework\\View\\Asset\\NotationResolver\\Module', [], [], '', false);
     $this->asset = $this->getMock('\\Magento\\Framework\\View\\Asset\\File', [], [], '', false);
     $this->asset->expects($this->any())->method('getContentType')->will($this->returnValue('css'));
     $this->relatedFileGeneratorMock = $this->getMockBuilder(RelatedGenerator::class)->disableOriginalConstructor()->getMock();
     $this->object = new Import($this->notationResolver, $this->relatedFileGeneratorMock);
 }
 /**
  * @param string $assetRelPath
  * @param string $relatedFieldId
  * @param string $similarRelPath
  * @param string $expectedResult
  * @dataProvider convertModuleNotationToPathModularSeparatorDataProvider
  */
 public function testConvertModuleNotationToPathModularSeparator($assetRelPath, $relatedFieldId, $similarRelPath, $expectedResult)
 {
     $similarAsset = $this->getMock('Magento\\Framework\\View\\Asset\\File', [], [], '', false);
     $similarAsset->expects($this->any())->method('getPath')->will($this->returnValue($similarRelPath));
     $this->asset->expects($this->once())->method('getPath')->will($this->returnValue($assetRelPath));
     $this->assetRepo->expects($this->once())->method('createSimilar')->with($relatedFieldId, $this->asset)->will($this->returnValue($similarAsset));
     $this->assertEquals($expectedResult, $this->object->convertModuleNotationToPath($this->asset, $relatedFieldId));
 }
 protected function setUp()
 {
     $this->mergerMock = $this->getMockForAbstractClass('\\Magento\\Framework\\View\\Asset\\MergeStrategyInterface');
     $this->dirMock = $this->getMockForAbstractClass('\\Magento\\Framework\\Filesystem\\Directory\\ReadInterface');
     $filesystem = $this->getMock('\\Magento\\Framework\\Filesystem', [], [], '', false);
     $filesystem->expects($this->once())->method('getDirectoryRead')->with(DirectoryList::STATIC_VIEW)->will($this->returnValue($this->dirMock));
     $this->fileExists = new FileExists($this->mergerMock, $filesystem);
     $this->resultAsset = $this->getMock('\\Magento\\Framework\\View\\Asset\\File', [], [], '', false);
     $this->resultAsset->expects($this->once())->method('getPath')->will($this->returnValue('foo/file'));
 }
 protected function setUp()
 {
     $this->design = $this->getMockForAbstractClass('\\Magento\\Framework\\View\\DesignInterface');
     $this->fileSource = $this->getMockForAbstractClass('\\Magento\\Framework\\View\\File\\CollectorInterface');
     $this->errorHandler = $this->getMockForAbstractClass('\\Magento\\Framework\\Less\\PreProcessor\\ErrorHandlerInterface');
     $this->asset = $this->getMock('\\Magento\\Framework\\View\\Asset\\File', [], [], '', false);
     $this->asset->expects($this->any())->method('getContentType')->will($this->returnValue('css'));
     $this->assetRepo = $this->getMock('\\Magento\\Framework\\View\\Asset\\Repository', [], [], '', false);
     $this->themeList = $this->getMockForAbstractClass('\\Magento\\Framework\\View\\Design\\Theme\\ListInterface');
     $this->object = new \Magento\Framework\Less\PreProcessor\Instruction\MagentoImport($this->design, $this->fileSource, $this->errorHandler, $this->assetRepo, $this->themeList);
 }
 protected function setUp()
 {
     $this->design = $this->getMockForAbstractClass('\\Magento\\Framework\\View\\DesignInterface');
     $this->fileSource = $this->getMockForAbstractClass('\\Magento\\Framework\\View\\File\\CollectorInterface');
     $this->errorHandler = $this->getMockForAbstractClass('\\Magento\\Framework\\Css\\PreProcessor\\ErrorHandlerInterface');
     $this->asset = $this->getMock('\\Magento\\Framework\\View\\Asset\\File', [], [], '', false);
     $this->asset->expects($this->any())->method('getContentType')->will($this->returnValue('css'));
     $this->assetRepo = $this->getMock('\\Magento\\Framework\\View\\Asset\\Repository', [], [], '', false);
     $this->themeProvider = $this->getMock(ThemeProviderInterface::class);
     $this->object = (new ObjectManager($this))->getObject(MagentoImport::class, ['design' => $this->design, 'fileSource' => $this->fileSource, 'errorHandler' => $this->errorHandler, 'assetRepo' => $this->assetRepo, 'themeProvider' => $this->themeProvider]);
 }
 /**
  * @covers \Magento\Cms\Model\Wysiwyg\Config::getSkinImagePlaceholderPath
  */
 public function testGetSkinImagePlaceholderPath()
 {
     $staticPath = 'pub/static';
     $placeholderPath = 'adminhtml/Magento/backend/en_US/Magento_Cms/images/wysiwyg_skin_image.png';
     $expectedResult = 'pub/static/adminhtml/Magento/backend/en_US/Magento_Cms/images/wysiwyg_skin_image.png';
     $this->storeManagerMock->expects($this->any())->method('getStore')->willReturn($this->storeMock);
     $this->storeMock->expects($this->any())->method('getBaseStaticDir')->willReturn($staticPath);
     $this->assetRepoMock->expects($this->any())->method('createAsset')->with(\Magento\Cms\Model\Wysiwyg\Config::WYSIWYG_SKIN_IMAGE_PLACEHOLDER_ID)->willReturn($this->assetFileMock);
     $this->assetFileMock->expects($this->once())->method('getPath')->willReturn($placeholderPath);
     $this->assertEquals($expectedResult, $this->wysiwygConfig->getSkinImagePlaceholderPath());
 }
 /**
  * Create mocks of assets to merge, as well as a few related necessary mocks
  *
  * @return array
  */
 private function getAssetsToMerge()
 {
     $one = $this->getMock('\\Magento\\Framework\\View\\Asset\\File', [], [], '', false);
     $one->expects($this->once())->method('getSourceFile')->will($this->returnValue('/dir/file/one.txt'));
     $two = $this->getMock('\\Magento\\Framework\\View\\Asset\\File', [], [], '', false);
     $two->expects($this->once())->method('getSourceFile')->will($this->returnValue('/dir/file/two.txt'));
     $this->sourceDir->expects($this->exactly(2))->method('getRelativePath')->will($this->onConsecutiveCalls('file/one.txt', 'file/two.txt'));
     $this->sourceDir->expects($this->exactly(2))->method('stat')->will($this->returnValue(['mtime' => '1']));
     $this->resultAsset->expects($this->once())->method('getPath')->will($this->returnValue('merged/result.txt'));
     return [$one, $two];
 }