add tests for array dump and load

This commit is contained in:
Toni Uebernickel 2012-02-22 10:19:26 +01:00
parent 82170e1718
commit 563a368687
2 changed files with 8 additions and 2 deletions

View file

@ -25,16 +25,18 @@ class YamlDataDumperTest extends TestCase
fb1:
Id: 10
Title: Hello
Tags: null
fb2:
Id: 20
Title: World
Tags: [foo, bar, baz]
YML;
$array = array(
'\Foo\Bar' => array(
'fb1' => array('Id' => 10, 'Title' => 'Hello'),
'fb2' => array('Id' => 20, 'Title' => 'World')
'fb1' => array('Id' => 10, 'Title' => 'Hello', 'Tags' => null),
'fb2' => array('Id' => 20, 'Title' => 'World', 'Tags' => array('foo', 'bar', 'baz'))
)
);

View file

@ -27,9 +27,11 @@ class YamlDataLoaderTest extends TestCase
fb1:
Id: 10
Title: Hello
Tags: null
fb2:
Id: 20
Title: World
Tags: [foo, bar, baz]
YML;
$this->tmpfile = (string) tmpfile();
file_put_contents($this->tmpfile, $fixtures);
@ -54,6 +56,8 @@ YML;
$this->assertEquals(2, count($subarray), 'There is two fixtures objects');
$this->assertArrayHasKey('fb1', $subarray);
$this->assertArrayHasKey('fb2', $subarray);
$this->assertTrue(is_array($subarray['fb2']['Tags']));
$this->assertEquals(array('foo', 'bar', 'baz'), $subarray['fb2']['Tags']);
}
}