* * 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:----svTCpZjLkgBt7Q9kBzk6lp9TzUHhQpXeVIyLMzrPjDTlaX8Y1jZ5eo8ESgp2imMz7lZjKPaKjJ4/scMhxEw9SD45pJp+4sUD0ndSZdPqPFCLCF99kKWC+qlSEow0e3hrxI63mep8CGuGCcD1gwPaFyJ4eDc/yG6ce6yO1n8c6OaoS/T5ECsZ1xoLWN/kJstsrIzseh2DHbQAf31k4wEyb/8mSTO85FbvNL/q7oFF3m98ENfhGGNoWWIXYY9Jq3HImSp7k0eJ21joBk6XSwqhXbBepQga5vRxMU/VELe8jUrGYZ0R+ZoSalzbWT9e8p+83qu+qrrpJsUXTOpNL93shI9nC89XicBzDzkPQrHfmxk5n9wFXnvGRsBlqgGIYZCDdYEBd2Ryp4A4Kdr/5TwFuDgT8GwCqcn/Y35K4vu5QGDUWkTybD3xaO4fGy5l5W1Uj43yRRAaZSwyeccl57zygi2bS0Vj5pRKR0kPaQ3Xkz7qW1o2BI57M1LhK56rTd5I3gUMocQ5SscPBjTkwZRETaqEMBXyxqcZtcxXz/GhXwmWtHJWz1pLfimojONj3TWUxmfliFH9dBz3UR3tD6xSn02B8qHeveD1kbX0JmT2rBJyDIyhT1Ta0MqM8ULwwyCAOj+lBoqnHv3HoaYifmpVYjZy0j3gYPKOiKbm4BOIY9I=----ATTACHMENT:----OTE2NzI0MzU2Mzc3MjM0MCAzNTg1NTk4OTk1ODQ0MjQxIDI5NTk2NzE2MDI4MDk1OTQ=