YamlTest.php 964 B

12345678910111213141516171819202122232425262728293031323334353637
  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\Yaml\Tests;
  11. use Symfony\Component\Yaml\Yaml;
  12. class YamlTest extends \PHPUnit_Framework_TestCase
  13. {
  14. public function testParseAndDump()
  15. {
  16. $data = array('lorem' => 'ipsum', 'dolor' => 'sit');
  17. $yml = Yaml::dump($data);
  18. $parsed = Yaml::parse($yml);
  19. $this->assertEquals($data, $parsed);
  20. }
  21. /**
  22. * @group legacy
  23. */
  24. public function testLegacyParseFromFile()
  25. {
  26. $filename = __DIR__.'/Fixtures/index.yml';
  27. $contents = file_get_contents($filename);
  28. $parsedByFilename = Yaml::parse($filename);
  29. $parsedByContents = Yaml::parse($contents);
  30. $this->assertEquals($parsedByFilename, $parsedByContents);
  31. }
  32. }