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:
commit
aa0399ef27
1
src/Symfony/Component/Yaml/Tests/Fixtures/embededPhp.yml
Normal file
1
src/Symfony/Component/Yaml/Tests/Fixtures/embededPhp.yml
Normal file
@ -0,0 +1 @@
|
||||
value: <?php echo 1 + 2 + 3 ?>
|
41
src/Symfony/Component/Yaml/Tests/YamlTest.php
Normal file
41
src/Symfony/Component/Yaml/Tests/YamlTest.php
Normal 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);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user