YamlTest.php 869 B

12345678910111213141516171819202122232425262728293031
  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. $filename = __DIR__.'/Fixtures/index.yml';
  21. $contents = file_get_contents($filename);
  22. $parsedByFilename = Yaml::parse($filename);
  23. $parsedByContents = Yaml::parse($contents);
  24. $this->assertEquals($parsedByFilename, $parsedByContents);
  25. }
  26. }