public function testTypeCastingSubObjectArrays()
{
$time = time();
$data = array('_id' => '4c8f86167675abfabd970300', 'accounts' => array(array('_id' => "4fb6e2dd3e91581fe6e75736", 'name' => 'Foo', 'created' => $time), array('_id' => "4fb6e2df3e91581fe6e75737", 'name' => 'Bar', 'created' => $time)));
$model = $this->_model;
$handlers = $this->_handlers;
$options = compact('model', 'handlers');
$schema = new Schema(array('fields' => $this->_schema));
$result = $schema->cast(null, null, $data, $options);
$this->assertEqual(array_keys($data), array_keys($result->data()));
$this->assertInstanceOf('MongoId', $result->_id);
$this->assertEqual('4c8f86167675abfabd970300', (string) $result->_id);
$this->assertInstanceOf('lithium\\data\\collection\\DocumentSet', $result->accounts);
$this->assertCount(2, $result->accounts);
$id1 = '4fb6e2dd3e91581fe6e75736';
$id2 = '4fb6e2df3e91581fe6e75737';
$this->assertInstanceOf('MongoId', $result->accounts[$id1]['_id']);
$this->assertEqual($id1, (string) $result->accounts[$id1]['_id']);
$this->assertInstanceOf('MongoId', $result->accounts[$id2]['_id']);
$this->assertEqual($id2, (string) $result->accounts[$id2]['_id']);
$this->assertInstanceOf('MongoDate', $result->accounts[$id1]['created']);
$this->assertGreaterThan($result->accounts[$id1]['created']->sec, 0);
$this->assertInstanceOf('MongoDate', $result->accounts[$id2]['created']);
$this->assertGreaterThan($result->accounts[$id2]['created']->sec, 0);
}