Add random_photo()

This commit is contained in:
Bharat Mediratta
2010-01-17 19:57:24 -08:00
parent c5f9a466c8
commit c9fd8d751d
@@ -28,4 +28,15 @@ class test_Core {
$album->title = "title_$rand";
return $album->save();
}
static function random_photo($parent=null) {
$rand = rand();
$photo = ORM::factory("item");
$photo->type = "photo";
$photo->parent_id = $parent ? $parent->id : 1;
$photo->set_data_file(MODPATH . "gallery/tests/test.jpg");
$photo->name = "name_$rand.jpg";
$photo->title = "title_$rand";
return $photo->save();
}
}