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