Skip to content

Commit

Permalink
Merge branch '2.8' into 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobion committed Mar 25, 2016
2 parents 0153c17 + d60b8e0 commit f7a07af
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions Tests/Writer/TranslationWriterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Component\Translation\Tests\Writer;

use Symfony\Component\Translation\Dumper\DumperInterface;
use Symfony\Component\Translation\MessageCatalogue;
use Symfony\Component\Translation\Writer\TranslationWriter;

Expand All @@ -30,18 +31,35 @@ public function testWriteTranslations()

public function testDisableBackup()
{
$dumper = $this->getMock('Symfony\Component\Translation\Dumper\DumperInterface');
$dumper
->expects($this->never())
->method('setBackup');
$phpDumper = $this->getMock('Symfony\Component\Translation\Dumper\PhpFileDumper');
$phpDumper
->expects($this->once())
->method('setBackup');
$nonBackupDumper = new NonBackupDumper();
$backupDumper = new BackupDumper();

$writer = new TranslationWriter();
$writer->addDumper('test', $dumper);
$writer->addDumper('php', $phpDumper);
$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;
}
}

0 comments on commit f7a07af

Please sign in to comment.