diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-01-17 19:57:24 -0800 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-01-17 19:57:24 -0800 |
commit | c9fd8d751d3bb46b8b0d6d5bea0cf8272f06c11b (patch) | |
tree | 6d3b4930c6cf42643eefd6ac88dc8458a1889c86 | |
parent | c5f9a466c88985857bd7ef9499b631520d4a3365 (diff) |
Add random_photo()
-rw-r--r-- | modules/gallery_unit_test/helpers/test.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/gallery_unit_test/helpers/test.php b/modules/gallery_unit_test/helpers/test.php index 2fa12a23..6dfa3cf0 100644 --- a/modules/gallery_unit_test/helpers/test.php +++ b/modules/gallery_unit_test/helpers/test.php @@ -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(); + } } |