Upgrade origin-src to google transit feed 1.2.6
[bus.git] / spyc / tests / .svn / text-base / DumpTest.php.svn-base
maxious 1 <?php
2
3 require_once ("../spyc.php");
4
5 class DumpTest extends PHPUnit_Framework_TestCase {
6
7 private $files_to_test = array();
8
9 public function setUp() {
10 $this->files_to_test = array ('../spyc.yaml', 'failing1.yaml', 'indent_1.yaml', 'quotes.yaml');
11 }
12
13 public function testDump() {
14 foreach ($this->files_to_test as $file) {
15 $yaml = spyc_load(file_get_contents($file));
16 $dump = Spyc::YAMLDump ($yaml);
17 $yaml_after_dump = Spyc::YAMLLoad ($dump);
18 $this->assertEquals ($yaml, $yaml_after_dump);
19 }
20 }
21
22 public function testDumpWithQuotes() {
23 $Spyc = new Spyc();
24 $Spyc->setting_dump_force_quotes = true;
25 foreach ($this->files_to_test as $file) {
26 $yaml = $Spyc->load(file_get_contents($file));
27 $dump = $Spyc->dump ($yaml);
28 $yaml_after_dump = Spyc::YAMLLoad ($dump);
29 $this->assertEquals ($yaml, $yaml_after_dump);
30 }
31 }
32
33 public function testDumpArrays() {
34 $dump = Spyc::YAMLDump(array ('item1', 'item2', 'item3'));
35 $awaiting = "---\n- item1\n- item2\n- item3\n";
36 $this->assertEquals ($awaiting, $dump);
37 }
38
39 public function testDumpNumerics() {
40 $dump = Spyc::YAMLDump(array ('404', '405', '500'));
41 $awaiting = "---\n- 404\n- 405\n- 500\n";
42 $this->assertEquals ($awaiting, $dump);
43 }
44
45 public function testDumpAsterisks() {
46 $dump = Spyc::YAMLDump(array ('*'));
47 $awaiting = "---\n- '*'\n";
48 $this->assertEquals ($awaiting, $dump);
49 }
50
51
52 public function testEmpty() {
53 $dump = Spyc::YAMLDump(array("foo" => array()));
54 $awaiting = "---\nfoo: [ ]\n";
55 $this->assertEquals ($awaiting, $dump);
56 }
57
58 }