public function testDumpTranslations()
 {
     $routeMock = $this->getMockBuilder('Symfony\\Component\\Routing\\Route')->disableOriginalConstructor()->getMock();
     $routeMock->expects($this->once())->method('getPath')->will($this->returnValue('/tmp/test{_locale}'));
     $routeCollectionMock = $this->getMock('Symfony\\Component\\Routing\\RouteCollection');
     $routeCollectionMock->expects($this->once())->method('get')->will($this->returnValue($routeMock));
     $this->routerMock->expects($this->once())->method('getRouteCollection')->will($this->returnValue($routeCollectionMock));
     $this->logger->expects($this->once())->method('info');
     $this->translationControllerMock->expects($this->once())->method('renderJsTranslationContent')->will($this->returnValue('test'));
     $this->dumper->dumpTranslations();
 }
 /**
  * @param string      $pathToSave path to save translations
  * @param array       $projects   project names
  * @param null|string $locale
  * @param bool        $toApply    whether apply download packs or not
  *
  * @throws \RuntimeException
  * @return bool
  */
 public function download($pathToSave, array $projects, $locale = null, $toApply = true)
 {
     $pathToSave = $pathToSave . self::FILE_NAME_SUFFIX;
     $targetDir = dirname($pathToSave);
     $this->cleanup($targetDir);
     $isDownloaded = $this->adapter->download($pathToSave, $projects, $locale);
     $isExtracted = $this->unzip($pathToSave, is_null($locale) ? $targetDir : rtrim($targetDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $locale);
     if ($locale == 'en') {
         // check and fix exported file names, replace $locale_XX locale in file names to $locale
         $this->renameFiles('.en_US.', '.en.', $targetDir);
     }
     if ($isExtracted) {
         unlink($pathToSave);
     }
     if ($toApply && $isExtracted) {
         $this->apply($locale, $targetDir);
         $this->cleanup($targetDir);
         $this->jsTranslationDumper->dumpTranslations([$locale]);
     }
     return $isExtracted && $isDownloaded;
 }