[Finder] tests for Yaml class

This commit is contained in:
Włodzimierz Gajda 2012-07-04 18:22:41 +02:00
parent 000d54cd27
commit 18f8fc7ff0
2 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1 @@
value: <?php echo 1 + 2 + 3 ?>

View File

@ -0,0 +1,41 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Yaml\Tests;
use Symfony\Component\Yaml\Yaml;
class YamlTest extends \PHPUnit_Framework_TestCase
{
public function testParseAndDump()
{
$data = array('lorem' => 'ipsum', 'dolor' => 'sit');
$yml = Yaml::dump($data);
$parsed = Yaml::parse($yml);
$this->assertEquals($data, $parsed);
$filename = __DIR__.'/Fixtures/index.yml';
$contents = file_get_contents($filename);
$parsedByFilename = Yaml::parse($filename);
$parsedByContents = Yaml::parse($contents);
$this->assertEquals($parsedByFilename, $parsedByContents);
}
public function testEmbededPhp()
{
$filename = __DIR__.'/Fixtures/embededPhp.yml';
Yaml::enablePhpParsing();
$parsed = Yaml::parse($filename);
$this->assertEquals(array('value' => 6), $parsed);
}
}