|
| 1 | +<?php |
| 2 | + |
| 3 | +/* |
| 4 | + * This file is part of the Symfony package. |
| 5 | + * |
| 6 | + * (c) Fabien Potencier <[email protected]> |
| 7 | + * |
| 8 | + * For the full copyright and license information, please view the LICENSE |
| 9 | + * file that was distributed with this source code. |
| 10 | + */ |
| 11 | + |
| 12 | +namespace Symfony\Component\Translation\Tests\Writer; |
| 13 | + |
| 14 | +use Symfony\Component\Translation\MessageCatalogue; |
| 15 | +use Symfony\Component\Translation\Writer\TranslationWriter; |
| 16 | + |
| 17 | +class TranslationWriterTest extends \PHPUnit_Framework_TestCase |
| 18 | +{ |
| 19 | + public function testWriteTranslations() |
| 20 | + { |
| 21 | + $dumper = $this->getMock('Symfony\Component\Translation\Dumper\DumperInterface'); |
| 22 | + $dumper |
| 23 | + ->expects($this->once()) |
| 24 | + ->method('dump'); |
| 25 | + |
| 26 | + $writer = new TranslationWriter(); |
| 27 | + $writer->addDumper('test', $dumper); |
| 28 | + $writer->writeTranslations(new MessageCatalogue(array()), 'test'); |
| 29 | + } |
| 30 | + |
| 31 | + public function testDisableBackup() |
| 32 | + { |
| 33 | + $dumper = $this->getMock('Symfony\Component\Translation\Dumper\DumperInterface'); |
| 34 | + $dumper |
| 35 | + ->expects($this->never()) |
| 36 | + ->method('setBackup'); |
| 37 | + $phpDumper = $this->getMock('Symfony\Component\Translation\Dumper\PhpFileDumper'); |
| 38 | + $phpDumper |
| 39 | + ->expects($this->once()) |
| 40 | + ->method('setBackup'); |
| 41 | + |
| 42 | + $writer = new TranslationWriter(); |
| 43 | + $writer->addDumper('test', $dumper); |
| 44 | + $writer->addDumper('php', $phpDumper); |
| 45 | + $writer->disableBackup(); |
| 46 | + } |
| 47 | +} |
0 commit comments