コード例 #1
0
ファイル: GeneratorTest.php プロジェクト: nja78/magento2
 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
ファイル: GeneratorTest.php プロジェクト: koliaGI/magento2
 public function testGeneration()
 {
     $this->assertFileNotExists($this->_packPath);
     ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_FirstModule', $this->_packPath . '/app/code/Magento/FirstModule');
     ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_SecondModule', $this->_packPath . '/app/code/Magento/SecondModule');
     ComponentRegistrar::register(ComponentRegistrar::THEME, 'adminhtml/default', $this->_packPath . '/app/design/adminhtml/default');
     $this->_generator->generate($this->_dictionaryPath, $this->_locale);
     foreach ($this->_expectedFiles as $file) {
         $this->assertFileEquals($this->_expectedDir . $file, $this->_packPath . $file);
     }
 }
コード例 #3
0
ファイル: GeneratorTest.php プロジェクト: koliaGI/magento2
 public function testGenerateWithNotAllowedDuplicatesAndDuplicatesExist()
 {
     $error = "Duplicated translation is found, but it is not allowed.\n" . "The phrase \"phrase1\" is translated in 1 places.\n" . "The phrase \"phrase2\" is translated in 1 places.\n";
     $this->setExpectedException('\\RuntimeException', $error);
     $allowDuplicates = false;
     $phraseFirstMock = $this->getMock('Magento\\Setup\\Module\\I18n\\Dictionary\\Phrase', [], [], '', false);
     $phraseFirstMock->expects($this->once())->method('getPhrase')->will($this->returnValue('phrase1'));
     $phraseSecondMock = $this->getMock('Magento\\Setup\\Module\\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\\Setup\\Module\\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', 'locale', 'mode', $allowDuplicates);
 }