merged branch gajdaw/finder_yaml_tests (PR #4749)

Commits
-------

18f8fc7 [Finder] tests for Yaml class

Discussion
----------

[Finder] tests for Yaml class

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: [![Build Status](https://secure.travis-ci.org/gajdaw/symfony.png?branch=master)](http://travis-ci.org/gajdaw/symfony)
Fixes the following tickets: -
Todo: -
License of the code: MIT
Documentation PR: -

Additional tests improving tests coverage.
This commit is contained in:
Fabien Potencier 2012-07-04 18:45:07 +02:00
commit aa0399ef27
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);
}
}