Exemplo n.º 1
0
 public function testWriteWithoutContext()
 {
     $this->_phraseFirstMock->expects($this->once())->method('getCompiledPhrase')->willReturn('phrase1');
     $this->_phraseFirstMock->expects($this->once())->method('getCompiledTranslation')->willReturn('translation1');
     $this->_phraseFirstMock->expects($this->once())->method('getContextType')->will($this->returnValue(''));
     $this->_phraseSecondMock->expects($this->once())->method('getCompiledPhrase')->willReturn('phrase2');
     $this->_phraseSecondMock->expects($this->once())->method('getCompiledTranslation')->willReturn('translation2');
     $this->_phraseSecondMock->expects($this->once())->method('getContextType')->willReturn('context_type2');
     $this->_phraseSecondMock->expects($this->once())->method('getContextValueAsString')->willReturn('');
     $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     /** @var \Magento\Setup\Module\I18n\Dictionary\Writer\Csv $writer */
     $writer = $objectManagerHelper->getObject('Magento\\Setup\\Module\\I18n\\Dictionary\\Writer\\Csv', ['outputFilename' => $this->_testFile]);
     $writer->write($this->_phraseFirstMock);
     $writer->write($this->_phraseSecondMock);
     $expected = "phrase1,translation1\nphrase2,translation2\n";
     $this->assertEquals($expected, file_get_contents($this->_testFile));
 }