Example #1
0
 public function testRegenerateStatic()
 {
     $storeLocales = ['fr_FR', 'de_DE', 'nl_NL'];
     $adminUserInterfaceLocales = ['de_DE', 'en_US'];
     $this->storeViewMock->expects($this->once())->method('retrieveLocales')->willReturn($storeLocales);
     $userMock = $this->getMock(\Magento\User\Model\User::class, [], [], '', false);
     $userMock->expects($this->once())->method('getInterfaceLocale')->willReturn('en_US');
     $this->userCollectionMock->expects($this->once())->method('getIterator')->willReturn(new \ArrayIterator([$userMock]));
     $usedLocales = array_unique(array_merge($storeLocales, $adminUserInterfaceLocales));
     $staticContentDeployCmd = $this->cmdPrefix . 'setup:static-content:deploy ' . implode(' ', $usedLocales);
     $setupDiCompileCmd = $this->cmdPrefix . 'setup:di:compile';
     $this->shellMock->expects($this->at(0))->method('execute')->with($staticContentDeployCmd);
     $this->shellMock->expects($this->at(1))->method('execute')->with($setupDiCompileCmd);
     $this->outputMock->expects($this->at(0))->method('writeln')->with('Starting deployment of static content');
     $this->outputMock->expects($this->at(2))->method('writeln')->with('Deployment of static content complete');
     $this->outputMock->expects($this->at(3))->method('writeln')->with('Starting compilation');
     $this->outputMock->expects($this->at(5))->method('writeln')->with('Compilation complete');
     $this->filesystem->regenerateStatic($this->outputMock);
 }
Example #2
0
 /**
  * Deploy static content
  *
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  * @return void
  * @throws \Exception
  */
 protected function deployStaticContent(\Symfony\Component\Console\Output\OutputInterface $output)
 {
     $output->writeln('Static content deployment start');
     $cmd = $this->functionCallPath . 'setup:static-content:deploy ' . implode(' ', $this->storeView->retrieveLocales());
     /**
      * @todo build a solution that does not depend on exec
      */
     $execOutput = $this->shell->execute($cmd);
     $output->writeln($execOutput);
     $output->writeln('Static content deployment complete');
 }
Example #3
0
 /**
  * Get used store and admin user locales
  *
  * @return []string
  */
 private function getUsedLocales()
 {
     $usedLocales = array_merge($this->storeView->retrieveLocales(), $this->getAdminUserInterfaceLocales());
     return array_unique($usedLocales);
 }