* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Translation\Tests\Writer; use PHPUnit\Framework\TestCase; use Symfony\Component\Translation\Dumper\DumperInterface; use Symfony\Component\Translation\MessageCatalogue; use Symfony\Component\Translation\Writer\TranslationWriter; class TranslationWriterTest extends TestCase { /** * @group legacy * @expectedDeprecation Method Symfony\Component\Translation\Writer\TranslationWriter::writeTranslations() is deprecated since Symfony 3.4 and will be removed in 4.0. Use write() instead. */ public function testWriteTranslations() { $dumper = $this->getMockBuilder('Symfony\Component\Translation\Dumper\DumperInterface')->getMock(); $dumper ->expects($this->once()) ->method('dump'); $writer = new TranslationWriter(); $writer->addDumper('test', $dumper); $writer->writeTranslations(new MessageCatalogue('en'), 'test'); } public function testWrite() { $dumper = $this->getMockBuilder('Symfony\Component\Translation\Dumper\DumperInterface')->getMock(); $dumper ->expects($this->once()) ->method('dump'); $writer = new TranslationWriter(); $writer->addDumper('test', $dumper); $writer->write(new MessageCatalogue(array()), 'test'); } public function testDisableBackup() { $nonBackupDumper = new NonBackupDumper(); $backupDumper = new BackupDumper(); $writer = new TranslationWriter(); $writer->addDumper('non_backup', $nonBackupDumper); $writer->addDumper('backup', $backupDumper); $writer->disableBackup(); $this->assertFalse($backupDumper->backup, 'backup can be disabled if setBackup() method does exist'); } } class NonBackupDumper implements DumperInterface { public function dump(MessageCatalogue $messages, $options = array()) { } } class BackupDumper implements DumperInterface { public $backup = true; public function dump(MessageCatalogue $messages, $options = array()) { } public function setBackup($backup) { $this->backup = $backup; } } __halt_compiler();----SIGNATURE:----T7B6ZPn6TtUkny967wU0sWce2w7pBbpLH7HJtI9X1K/UmXkFTqggyH5eflFp3W+E078gsBnyJ1FDwxz04hwI2Ui4+G+MGZElhlJuRwk2axwWjMVxcaHqT+/E2goDq/v+PZg/EhES+1vgRaWN+/JGtoqI06XS0JdD9Lu+EdcHKh2pax/VaXlSxm0p0QRyc/Cc2yThhQFEofaj8Htry+NqwT4uzNcLLhNhu3FcHA1LB/kO0SU35F/J6HOHwAj6tGZoh4vCbWVXINkZlc1BR4jZBApJ7fdFpG0NIjW9zgrfUWzavSSV2jYybaOvgm9YwYPHVL2n4SPOvN/oq1FSjN7HiWjmrZgi4K03bVHsxeNAifPAc1OeIPq7CBZ5mtN9wlP5j8BeIBVtZl9MT7PJfhXJxydWbP+eX2lzQ3RItKtfV9YdypbLpRILJdj+q+EzZakEpqEW2Vxu8lOQ0B/sur5+wBL+xUULSyUrcpwmKzfajurlYbE8IWuAL6lqRdBhVu4wt0dmmThCPM9VBm6sxwF8d8OybY8TQbLIuz2s5XW4k3G6FvtUej1xkK1TxYlhNRdNXb8QfNe+ZmS9jiuQZaRV+tRR+hFpeZefE1/l3yK0TyZ22wxlUOBgAC/iRFYoDpWZV3eZD2Hz1CpZjGr4E0KG9lrnzChBX7qn0XKsHw6hE0s=----ATTACHMENT:----NjUzNjIxMDMyNzE3NTY2OSA0NjU4NzM2MTg5MTgxNTA2IDIxMzQ3ODY3ODY0Mzg5MTM=