Version 1
[yaffs-website] / vendor / symfony / translation / Tests / Dumper / YamlFileDumperTest.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\Translation\Tests\Dumper;
13
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\Translation\MessageCatalogue;
16 use Symfony\Component\Translation\Dumper\YamlFileDumper;
17
18 class YamlFileDumperTest extends TestCase
19 {
20     public function testTreeFormatCatalogue()
21     {
22         $catalogue = new MessageCatalogue('en');
23         $catalogue->add(
24             array(
25                 'foo.bar1' => 'value1',
26                 'foo.bar2' => 'value2',
27             ));
28
29         $dumper = new YamlFileDumper();
30
31         $this->assertStringEqualsFile(__DIR__.'/../fixtures/messages.yml', $dumper->formatCatalogue($catalogue, 'messages', array('as_tree' => true, 'inline' => 999)));
32     }
33
34     public function testLinearFormatCatalogue()
35     {
36         $catalogue = new MessageCatalogue('en');
37         $catalogue->add(
38             array(
39                 'foo.bar1' => 'value1',
40                 'foo.bar2' => 'value2',
41             ));
42
43         $dumper = new YamlFileDumper();
44
45         $this->assertStringEqualsFile(__DIR__.'/../fixtures/messages_linear.yml', $dumper->formatCatalogue($catalogue, 'messages'));
46     }
47 }