4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Translation\Tests\Dumper
;
14 use Symfony\Component\Translation\MessageCatalogue
;
15 use Symfony\Component\Translation\Dumper\YamlFileDumper
;
17 class YamlFileDumperTest
extends \PHPUnit_Framework_TestCase
19 protected function setUp()
21 if (!class_exists('Symfony\Component\Yaml\Yaml')) {
22 $this->markTestSkipped('The "Yaml" component is not available');
26 public function testDump()
28 $catalogue = new MessageCatalogue('en');
29 $catalogue->add(array('foo' => 'bar'));
31 $tempDir = sys_get_temp_dir();
32 $dumper = new YamlFileDumper();
33 $dumper->dump($catalogue, array('path' => $tempDir));
35 $this->assertEquals(file_get_contents(__DIR__
.'/../fixtures/resources.yml'), file_get_contents($tempDir.'/messages.en.yml'));
37 unlink($tempDir.'/messages.en.yml');