public function testGenerationWithContext() { $this->generator->generate($this->source, $this->outputFileName, true); $expected = explode(PHP_EOL, file_get_contents($this->expectedDir . '/with_context.csv')); $output = file_get_contents($this->outputFileName); foreach ($expected as $line) { if ($line) { $this->assertContains($line, $output); } } }
/** * @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); }
public function testGenerationWithContext() { $this->generator->generate($this->source, $this->outputFileName, true); $this->assertFileEquals($this->expectedDir . '/with_context.csv', $this->outputFileName); }