[2.7] fix mocking of some methods
This commit is contained in:
parent
505bf4db5d
commit
a45b93d423
@ -99,7 +99,7 @@ class KernelTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testClassCacheIsNotLoadedByDefault()
|
public function testClassCacheIsNotLoadedByDefault()
|
||||||
{
|
{
|
||||||
$kernel = $this->getKernel(array('initializeBundles', 'initializeContainer'));
|
$kernel = $this->getKernel(array('initializeBundles', 'initializeContainer', 'doLoadClassCache'));
|
||||||
$kernel->expects($this->never())
|
$kernel->expects($this->never())
|
||||||
->method('doLoadClassCache');
|
->method('doLoadClassCache');
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Translation\Tests\Writer;
|
namespace Symfony\Component\Translation\Tests\Writer;
|
||||||
|
|
||||||
|
use Symfony\Component\Translation\Dumper\DumperInterface;
|
||||||
use Symfony\Component\Translation\MessageCatalogue;
|
use Symfony\Component\Translation\MessageCatalogue;
|
||||||
use Symfony\Component\Translation\Writer\TranslationWriter;
|
use Symfony\Component\Translation\Writer\TranslationWriter;
|
||||||
|
|
||||||
@ -30,18 +31,35 @@ class TranslationWriterTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testDisableBackup()
|
public function testDisableBackup()
|
||||||
{
|
{
|
||||||
$dumper = $this->getMock('Symfony\Component\Translation\Dumper\DumperInterface');
|
$nonBackupDumper = new NonBackupDumper();
|
||||||
$dumper
|
$backupDumper = new BackupDumper();
|
||||||
->expects($this->never())
|
|
||||||
->method('setBackup');
|
|
||||||
$phpDumper = $this->getMock('Symfony\Component\Translation\Dumper\PhpFileDumper');
|
|
||||||
$phpDumper
|
|
||||||
->expects($this->once())
|
|
||||||
->method('setBackup');
|
|
||||||
|
|
||||||
$writer = new TranslationWriter();
|
$writer = new TranslationWriter();
|
||||||
$writer->addDumper('test', $dumper);
|
$writer->addDumper('non_backup', $nonBackupDumper);
|
||||||
$writer->addDumper('php', $phpDumper);
|
$writer->addDumper('backup', $backupDumper);
|
||||||
$writer->disableBackup();
|
$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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user