* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Translation\Tests\Dumper; use PHPUnit\Framework\TestCase; use Symfony\Component\Translation\MessageCatalogue; use Symfony\Component\Translation\Dumper\FileDumper; class FileDumperTest extends TestCase { public function testDump() { $tempDir = sys_get_temp_dir(); $catalogue = new MessageCatalogue('en'); $catalogue->add(array('foo' => 'bar')); $dumper = new ConcreteFileDumper(); $dumper->dump($catalogue, array('path' => $tempDir)); $this->assertFileExists($tempDir.'/messages.en.concrete'); @unlink($tempDir.'/messages.en.concrete'); } /** * @group legacy */ public function testDumpBackupsFileIfExisting() { $tempDir = sys_get_temp_dir(); $file = $tempDir.'/messages.en.concrete'; $backupFile = $file.'~'; @touch($file); $catalogue = new MessageCatalogue('en'); $catalogue->add(array('foo' => 'bar')); $dumper = new ConcreteFileDumper(); $dumper->dump($catalogue, array('path' => $tempDir)); $this->assertFileExists($backupFile); @unlink($file); @unlink($backupFile); } public function testDumpCreatesNestedDirectoriesAndFile() { $tempDir = sys_get_temp_dir(); $translationsDir = $tempDir.'/test/translations'; $file = $translationsDir.'/messages.en.concrete'; $catalogue = new MessageCatalogue('en'); $catalogue->add(array('foo' => 'bar')); $dumper = new ConcreteFileDumper(); $dumper->setRelativePathTemplate('test/translations/%domain%.%locale%.%extension%'); $dumper->dump($catalogue, array('path' => $tempDir)); $this->assertFileExists($file); @unlink($file); @rmdir($translationsDir); } } class ConcreteFileDumper extends FileDumper { public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()) { return ''; } protected function getExtension() { return 'concrete'; } } __halt_compiler();----SIGNATURE:----kTVEpNJvK0ZgmMFseDcPR4/IeE2sxfKgIafd48wMMZMfCXIy5cDQcL2zjF+k/wJBJgxVlf5PQQHTB7+diReyY3tGRtuq7vmAX4z7li/ROgum5FbPP/aOHCPFZdoHWk1SoNvZudtspMyapaZ3BMYsB8k4U3DUTlWZT6eV9TU6G20OaaNTKC1AnPxeiClER8PzNYLerHzJuQOjf8T6r8C49BbUpXEzmlvaLPio90mamQxLJFYBp7o9XMAbtOGbg312i/ZjbywW2d4IU0/6ONyefqmVyke4amXdQlTMr17mrULkYZV+LExN4MPLMNLlz5KWcbCsn61kw2hBTPsu2uLUGL3RFf1FAYxHEggJtPJd8dDqINlEe21cj5ijuV1QygQSb2WOtrTd5D/pNylhpHCWecH8eXX9cExW6OwTsdvFErhMZy0u3Ia0WchvvcHB2HRFQRP+xopOXYDIdKEkaSfwz2FKydNYZJMdo7hG3M4k2ExRp01iM9nVjT6MZFhiEfnUKYXz/de11Enq3IR8ApQDE1PBCAeEO/IgsWh5qY7h2xy9prHSkQ88tLTsw2WsTzEibgnoLtP9+tFCk8RbJCXpFkpoK/Cdaca2tT6/OZSgHBKxFO+3smEG+5kSiQBi0gHNV5dF4C0GorrkOcs0OWUYLEkZCDNbXo4AEt+cxCGVHJ4=----ATTACHMENT:----Nzc5NDE0MDU0MzMwMTA4OCA1MzMwMzIwMDg2NjU4MDgzIDI3NTg2MzY2MDQ2OTEwNzc=