summaryrefslogtreecommitdiff
path: root/modules/gallery_unit_test/helpers/test.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-12-15 14:57:00 -0800
committerBharat Mediratta <bharat@menalto.com>2010-12-15 14:57:00 -0800
commitcd48b89f3166e7fa732b5cb06d33fba018af9127 (patch)
tree9ad981df0d736dc186463aac4676fdba2bc232b8 /modules/gallery_unit_test/helpers/test.php
parent45c63f4d118bfc99924edb8685442035349af6db (diff)
Consolidate all the random code into a random helper that offers:
random::hash() random::string() random::percent() random::int() So that we don't have lots of different ways to get random values all over the code. Follow-on to #1527.
Diffstat (limited to 'modules/gallery_unit_test/helpers/test.php')
-rw-r--r--modules/gallery_unit_test/helpers/test.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/modules/gallery_unit_test/helpers/test.php b/modules/gallery_unit_test/helpers/test.php
index d5149492..65c7f6b4 100644
--- a/modules/gallery_unit_test/helpers/test.php
+++ b/modules/gallery_unit_test/helpers/test.php
@@ -19,7 +19,7 @@
*/
class test_Core {
static function random_album_unsaved($parent=null) {
- $rand = mt_rand();
+ $rand = random::string(6);
$album = ORM::factory("item");
$album->type = "album";
@@ -34,7 +34,7 @@ class test_Core {
}
static function random_photo_unsaved($parent=null) {
- $rand = mt_rand();
+ $rand = random::string(6);
$photo = ORM::factory("item");
$photo->type = "photo";
$photo->parent_id = $parent ? $parent->id : 1;
@@ -49,16 +49,16 @@ class test_Core {
}
static function random_user($password="password") {
- $rand = "name_" . mt_rand();
+ $rand = "name_" . random::string(6);
return identity::create_user($rand, $rand, $password, "$rand@rand.com");
}
static function random_group() {
- return identity::create_group((string)mt_rand());
+ return identity::create_group(random::string(6));
}
static function random_name($item=null) {
- $rand = "name_" . mt_rand();
+ $rand = "name_" . random::string(6);
if ($item && $item->is_photo()) {
$rand .= ".jpg";
}
@@ -77,7 +77,7 @@ class test_Core {
static function random_tag() {
$tag = ORM::factory("tag");
- $tag->name = (string)mt_rand();
+ $tag->name = random::string(6);
// Reload so that ORM coerces all fields into strings.
return $tag->save()->reload();