コード例 #1
0
 /**
  * Run test for process method
  */
 public function testProcess()
 {
     $this->lockerProcessMock->expects(self::once())->method('lockProcess')->with(self::isType('string'));
     $this->lockerProcessMock->expects(self::once())->method('unlockProcess');
     $assetMock = $this->getAssetNew();
     $this->assetBuilderMock->expects(self::once())->method('setArea')->with(self::AREA)->willReturnSelf();
     $this->assetBuilderMock->expects(self::once())->method('setTheme')->with(self::THEME)->willReturnSelf();
     $this->assetBuilderMock->expects(self::once())->method('setLocale')->with(self::LOCALE)->willReturnSelf();
     $this->assetBuilderMock->expects(self::once())->method('setModule')->with(self::MODULE)->willReturnSelf();
     $this->assetBuilderMock->expects(self::once())->method('setPath')->with(self::FILE_PATH)->willReturnSelf();
     $this->assetBuilderMock->expects(self::once())->method('build')->willReturn($assetMock);
     $this->alternativeSourceMock->expects(self::once())->method('getAlternativesExtensionsNames')->willReturn(['less']);
     $this->assetSourceMock->expects(self::once())->method('getContent')->with($assetMock)->willReturn(self::NEW_CONTENT);
     $frontendCompilation = new FrontendCompilation($this->assetSourceMock, $this->assetBuilderMock, $this->alternativeSourceMock, $this->lockerProcessMock, 'lock');
     $frontendCompilation->process($this->getChainMockExpects());
 }
コード例 #2
0
 /**
  * Run test for process method
  */
 public function testProcess()
 {
     $alternatives = ['processor' => [AlternativeSource::PROCESSOR_CLASS => 'Magento\\Framework\\View\\Asset\\ContentProcessorInterface']];
     $this->lockerProcessMock->expects(self::once())->method('lockProcess')->with(self::isType('string'));
     $this->lockerProcessMock->expects(self::once())->method('unlockProcess');
     $this->sorterMock->expects(self::once())->method('sort')->with($alternatives)->willReturn($alternatives);
     $assetMock = $this->getAssetNew();
     $this->assetBuilderMock->expects(self::once())->method('setArea')->with(self::AREA)->willReturnSelf();
     $this->assetBuilderMock->expects(self::once())->method('setTheme')->with(self::THEME)->willReturnSelf();
     $this->assetBuilderMock->expects(self::once())->method('setLocale')->with(self::LOCALE)->willReturnSelf();
     $this->assetBuilderMock->expects(self::once())->method('setModule')->with(self::MODULE)->willReturnSelf();
     $this->assetBuilderMock->expects(self::once())->method('setPath')->with(self::FILE_PATH)->willReturnSelf();
     $this->assetBuilderMock->expects(self::once())->method('build')->willReturn($assetMock);
     $this->objectManagerMock->expects(self::once())->method('get')->with('Magento\\Framework\\View\\Asset\\ContentProcessorInterface')->willReturn($this->getProcessorMock($assetMock));
     $alternativeSource = new AlternativeSource($this->objectManagerMock, $this->lockerProcessMock, $this->sorterMock, $this->assetBuilderMock, 'lock', $alternatives);
     $alternativeSource->process($this->getChainMockExpects());
 }