From c9fd8d751d3bb46b8b0d6d5bea0cf8272f06c11b Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 17 Jan 2010 19:57:24 -0800 Subject: Add random_photo() --- modules/gallery_unit_test/helpers/test.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'modules/gallery_unit_test') 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(); + } } -- cgit v1.2.3