public function testReadWriteMultiple()
{
$this->skipIf($this->with(array('CouchDb')));
$galleries = array();
$key = Galleries::meta('key');
foreach ($this->galleriesData as $data) {
$galleries[] = Galleries::create($data);
$this->assertTrue(end($galleries)->save());
$this->assertNotEmpty(end($galleries)->{$key});
}
$this->assertIdentical(2, Galleries::count());
$this->assertIdentical(1, Galleries::count(array('active' => true)));
$this->assertIdentical(1, Galleries::count(array('active' => false)));
$this->assertIdentical(0, Galleries::count(array('active' => null)));
$all = Galleries::all();
$this->assertIdentical(2, Galleries::count());
$expected = count($this->galleriesData);
$this->assertEqual($expected, $all->count());
$this->assertEqual($expected, count($all));
$id = (string) $all->first()->{$key};
$this->assertTrue(strlen($id) > 0);
$this->assertNotEmpty($all->data());
foreach ($galleries as $galleries) {
$this->assertTrue($galleries->delete());
}
$this->assertIdentical(0, Galleries::count());
}