Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[Finder] tests for Yaml class

  • Loading branch information...
commit aeba5f4c420d04996b2fd46b0ca35dbd4ed2bab5 1 parent fa301d6
@gajdaw gajdaw authored
Showing with 42 additions and 0 deletions.
  1. +1 −0  Tests/Fixtures/embededPhp.yml
  2. +41 −0 Tests/YamlTest.php
View
1  Tests/Fixtures/embededPhp.yml
@@ -0,0 +1 @@
+value: <?php echo 1 + 2 + 3 ?>
View
41 Tests/YamlTest.php
@@ -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);
+ }
+
+}
Please sign in to comment.
Something went wrong with that request. Please try again.