/**
  * Get dictionary generator
  *
  * @return \Magento\Setup\Module\I18n\Dictionary\Generator
  */
 public static function getDictionaryGenerator()
 {
     if (null === self::$_dictionaryGenerator) {
         $filesCollector = new FilesCollector();
         $phraseCollector = new Parser\Adapter\Php\Tokenizer\PhraseCollector(new Parser\Adapter\Php\Tokenizer());
         $adapters = ['php' => new Parser\Adapter\Php($phraseCollector), 'html' => new Parser\Adapter\Html(), 'js' => new Parser\Adapter\Js(), 'xml' => new Parser\Adapter\Xml()];
         $parser = new Parser\Parser($filesCollector, self::_getFactory());
         $parserContextual = new Parser\Contextual($filesCollector, self::_getFactory(), self::_getContext());
         foreach ($adapters as $type => $adapter) {
             $parser->addAdapter($type, $adapter);
             $parserContextual->addAdapter($type, $adapter);
         }
         self::$_dictionaryGenerator = new Dictionary\Generator($parser, $parserContextual, self::_getFactory(), new Dictionary\Options\ResolverFactory());
     }
     return self::$_dictionaryGenerator;
 }
 /**
  * @expectedException \UnexpectedValueException
  * @expectedExceptionMessage No phrases found in the specified dictionary file.
  */
 public function testGenerateWithNoPhrases()
 {
     $baseDir = 'no_phrases';
     $outputFilename = 'no_file.csv';
     $filesOptions = ['file1', 'file2'];
     $optionResolver = $this->getMock('Magento\\Setup\\Module\\I18n\\Dictionary\\Options\\Resolver', [], [], '', false);
     $optionResolver->expects($this->once())->method('getOptions')->will($this->returnValue($filesOptions));
     $this->optionsResolverFactory->expects($this->once())->method('create')->with($this->equalTo($baseDir), $this->equalTo(true))->will($this->returnValue($optionResolver));
     $this->contextualParserMock->expects($this->once())->method('parse')->with($filesOptions);
     $this->contextualParserMock->expects($this->once())->method('getPhrases')->will($this->returnValue([]));
     $this->generator->generate($baseDir, $outputFilename, true);
 }