コード例 #1
0
 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);
     }
 }
コード例 #2
0
 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\\Code\\Dictionary\\Phrase', array(), array(), '', false);
     $phraseFirstMock->expects($this->once())->method('getPhrase')->will($this->returnValue('phrase1'));
     $phraseSecondMock = $this->getMock('Magento\\Tools\\I18n\\Code\\Dictionary\\Phrase', array(), array(), '', 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\\Code\\Dictionary\\Phrase', [], [], '', false)];
     $this->dictionaryMock->expects($this->once())->method('getPhrases')->will($this->returnValue([$phrases]));
     $this->dictionaryMock->expects($this->once())->method('getDuplicates')->will($this->returnValue(array(array($phraseFirstMock), array($phraseSecondMock))));
     $this->_generator->generate('dictionary_path', 'pack_path', 'locale', 'mode', $allowDuplicates);
 }