public function testDumpWithQuotes() { $Cyps = new Cyps(); $Cyps->setting_dump_force_quotes = true; foreach ($this->files_to_test as $file) { $yaml = $Cyps->load(file_get_contents($file)); $dump = $Cyps->dump($yaml); $yaml_after_dump = Cyps::YAMLLoad($dump); $this->assertEquals($yaml, $yaml_after_dump); } }
public function testABCD2() { $a = array('a', 'b', 'c', 'd'); // Create a simple list $b = Cyps::YAMLDump($a); // Dump the list as YAML $c = Cyps::YAMLLoad($b); // Load the dumped YAML $d = Cyps::YAMLDump($c); // Re-dump the data $this->assertSame($b, $d); }
protected function setUp() { $this->Y = Cyps::YAMLLoad("indent_1.yaml"); }
public function testMultipleArrays() { $expected = array(array(array('x'))); $this->assertSame($expected, Cyps::YAMLLoad("- - - x")); }
/** * Parses YAML to array. * @param string $file Path to YAML file. * @return array */ function cyps_load_file($file) { return Cyps::YAMLLoad($file); }
<?php # # S P Y C # a simple php yaml class # # license: [MIT License, http://www.opensource.org/licenses/mit-license.php] # include '../Cyps.php'; $array = Cyps::YAMLLoad('../cyps.yaml'); echo '<pre><a href="cyps.yaml">cyps.yaml</a> loaded into PHP:<br/>'; print_r($array); echo '</pre>'; echo '<pre>YAML Data dumped back:<br/>'; echo Cyps::YAMLDump($array); echo '</pre>';