Example #1
0
 /**
  * @expectedException \UnexpectedValueException
  * @expectedExceptionMessage No phrases found in the specified dictionary file.
  */
 public function testGenerateWithNoPhrases()
 {
     $baseDir = 'no_phrases';
     $outputFilename = 'no_file.csv';
     $filesOptions = array('file1', 'file2');
     $optionResolver = $this->getMock('Magento\\Tools\\I18n\\Code\\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);
 }
Example #2
0
 public function testGenerationWithContext()
 {
     $this->generator->generate($this->source, $this->outputFileName, true);
     $this->assertFileEquals($this->expectedDir . '/with_context.csv', $this->outputFileName);
 }