/**
  * Run test for execute method
  */
 public function testExecute()
 {
     /** @var OutputInterface|\PHPUnit_Framework_MockObject_MockObject $outputMock */
     $outputMock = $this->getMockBuilder(OutputInterface::class)->getMockForAbstractClass();
     $assetMock = $this->getMockBuilder(LocalInterface::class)->getMockForAbstractClass();
     $this->validatorMock->expects(self::once())->method('isValid')->with(self::LOCALE_TEST_VALUE)->willReturn(true);
     $message = sprintf('<info>Processed Area: %s, Locale: %s, Theme: %s, File type: %s.</info>', self::AREA_TEST_VALUE, self::LOCALE_TEST_VALUE, self::THEME_TEST_VALUE, self::TYPE_TEST_VALUE);
     $outputMock->expects(self::at(0))->method('writeln')->with($message);
     $outputMock->expects(self::at(1))->method('writeln')->with('<comment>-> file-test-value/test/file</comment>');
     $outputMock->expects(self::at(2))->method('writeln')->with('<info>Successfully processed.</info>');
     $this->assetRepositoryMock->expects(self::once())->method('createAsset')->with('file-test-value/test' . DIRECTORY_SEPARATOR . 'file' . '.' . self::TYPE_TEST_VALUE, ['area' => self::AREA_TEST_VALUE, 'theme' => self::THEME_TEST_VALUE, 'locale' => self::LOCALE_TEST_VALUE])->willReturn($assetMock);
     $this->assetPublisherMock->expects(self::once())->method('publish')->with($assetMock);
     $assetMock->expects(self::once())->method('getFilePath')->willReturn(self::FILE_TEST_VALUE);
     $this->sourceThemeDeployCommand->run($this->getInputMock(), $outputMock);
 }
 /**
  * Run test for execute method with non existing theme
  *
  * @expectedException \InvalidArgumentException
  * @expectedExceptionMessage Verify entered values of the argument and options.
  */
 public function testExecuteNonExistingValue()
 {
     /** @var OutputInterface|\PHPUnit_Framework_MockObject_MockObject $outputMock */
     $outputMock = $this->getMockBuilder(OutputInterface::class)->getMockForAbstractClass();
     $assetMock = $this->getMockBuilder(LocalInterface::class)->getMockForAbstractClass();
     $this->validatorMock->expects(self::once())->method('isValid')->with(self::LOCALE_TEST_VALUE)->willReturn(true);
     $this->assetRepositoryMock->expects(self::once())->method('createAsset')->with('file-test-value/test' . DIRECTORY_SEPARATOR . 'file' . '.' . self::TYPE_TEST_VALUE, ['area' => self::AREA_TEST_VALUE, 'theme' => self::THEME_NONEXISTING_VALUE, 'locale' => self::LOCALE_TEST_VALUE])->willReturn($assetMock);
     $this->assetPublisherMock->expects(self::once())->method('publish')->with($assetMock)->willThrowException(new \Magento\Framework\View\Asset\File\NotFoundException());
     $valueMap = [['area', self::AREA_TEST_VALUE], ['locale', self::LOCALE_TEST_VALUE], ['theme', self::THEME_NONEXISTING_VALUE], ['type', self::TYPE_TEST_VALUE]];
     $this->sourceThemeDeployCommand->run($this->getInputMock($valueMap), $outputMock);
 }
 /**
  * @param string $mode
  * @param string $requestedPath
  * @param string $requestedModule
  * @param bool $moduleExists
  * @param string $expectedFile
  * @param array $expectedParams
  *
  * @dataProvider launchDataProvider
  */
 public function testLaunch($mode, $requestedPath, $requestedModule, $moduleExists, $expectedFile, array $expectedParams)
 {
     $this->state->expects($this->once())->method('getMode')->will($this->returnValue($mode));
     $this->state->expects($this->once())->method('setAreaCode')->with('area');
     $this->configLoader->expects($this->once())->method('load')->with('area')->will($this->returnValue(['config']));
     $this->objectManager->expects($this->once())->method('configure')->with(['config']);
     $this->request->expects($this->once())->method('get')->with('resource')->will($this->returnValue($requestedPath));
     $this->moduleList->expects($this->any())->method('has')->with($requestedModule)->will($this->returnValue($moduleExists));
     $asset = $this->getMockForAbstractClass('\\Magento\\Framework\\View\\Asset\\LocalInterface');
     $asset->expects($this->once())->method('getSourceFile')->will($this->returnValue('resource/file.css'));
     $this->assetRepo->expects($this->once())->method('createAsset')->with($expectedFile, $expectedParams)->will($this->returnValue($asset));
     $this->publisher->expects($this->once())->method('publish')->with($asset);
     $this->response->expects($this->once())->method('setFilePath')->with('resource/file.css');
     $this->object->launch();
 }