public function testGeneration() { $this->assertFileNotExists($this->_packPath); $this->_generator->generate($this->_dictionaryPath, $this->_packPath, $this->_locale); foreach ($this->_expectedFiles as $file) { $this->assertFileEquals($this->_expectedDir . $file, $this->_packPath . $file); } }
public function testGenerateWithNotAllowedDuplicatesAndDuplicatesExist() { $error = "Duplicated translation is found, but it is not allowed.\n" . "The phrase \"phrase1\" is translated differently in 1 places.\n" . "The phrase \"phrase2\" is translated differently in 1 places.\n"; $this->setExpectedException('\\RuntimeException', $error); $allowDuplicates = false; $phraseFirstMock = $this->getMock('Magento\\Tools\\I18n\\Dictionary\\Phrase', [], [], '', false); $phraseFirstMock->expects($this->once())->method('getPhrase')->will($this->returnValue('phrase1')); $phraseSecondMock = $this->getMock('Magento\\Tools\\I18n\\Dictionary\\Phrase', [], [], '', false); $phraseSecondMock->expects($this->once())->method('getPhrase')->will($this->returnValue('phrase2')); $this->dictionaryLoaderMock->expects($this->any())->method('load')->will($this->returnValue($this->dictionaryMock)); $phrases = [$this->getMock('Magento\\Tools\\I18n\\Dictionary\\Phrase', [], [], '', false)]; $this->dictionaryMock->expects($this->once())->method('getPhrases')->will($this->returnValue([$phrases])); $this->dictionaryMock->expects($this->once())->method('getDuplicates')->will($this->returnValue([[$phraseFirstMock], [$phraseSecondMock]])); $this->_generator->generate('dictionary_path', 'pack_path', 'locale', 'mode', $allowDuplicates); }