protected function configureAdminArea()
 {
     $config = ['test config'];
     $this->configLoaderMock->expects($this->once())->method('load')->with(FrontNameResolver::AREA_CODE)->will($this->returnValue($config));
     $this->objectManager->expects($this->once())->method('configure')->with($config);
     $this->stateMock->expects($this->once())->method('setAreaCode')->with(FrontNameResolver::AREA_CODE);
 }
 /**
  * @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();
 }
 public function testExecute()
 {
     $file = 'css/styles-m' . '.less';
     $this->configLoader->expects($this->once())->method('load')->with('frontend')->willReturn([]);
     $this->objectManager->expects($this->once())->method('configure');
     $this->sourceFileGeneratorPool->expects($this->once())->method('create')->with('less')->willReturn($this->getMock('Magento\\Framework\\Less\\FileGenerator', [], [], '', false));
     $this->assetRepo->expects($this->once())->method('createAsset')->with($file, ['area' => 'frontend', 'theme' => 'Magento/blank', 'locale' => 'en_US'])->willReturn($this->getMockForAbstractClass('Magento\\Framework\\View\\Asset\\LocalInterface'));
     $this->assetSource->expects($this->once())->method('findSource')->willReturn('/dev/null');
     $this->chainFactory->expects($this->once())->method('create')->willReturn($this->getMock('Magento\\Framework\\View\\Asset\\PreProcessor\\Chain', [], [], '', false));
     $this->filesystem->expects($this->atLeastOnce())->method('getDirectoryWrite')->willReturn($this->getMock('\\Magento\\Framework\\Filesystem\\Directory\\WriteInterface', [], [], '', false));
     $this->validator->expects($this->once())->method('isValid')->with('en_US')->willReturn(true);
     $commandTester = new CommandTester($this->command);
     $commandTester->execute(['type' => 'less']);
     $this->assertContains('Successfully processed LESS and/or SASS files', $commandTester->getDisplay());
 }