暂无描述

YamlFileDumperTest.php 1.3KB

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