summaryrefslogtreecommitdiff
path: root/modules/tag/tests
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-01-20 00:14:05 -0800
committerBharat Mediratta <bharat@menalto.com>2010-01-20 00:14:05 -0800
commit276d7de5b6254222aee828de54f21af6ee4c0a15 (patch)
tree91086d24ecf3e56455df1495e3ce1b90f85b7a98 /modules/tag/tests
parent5f83da41e405dd274634fa520c5c08bfd885164a (diff)
Simplify and update for model based validation.
Diffstat (limited to 'modules/tag/tests')
-rw-r--r--modules/tag/tests/Tag_Test.php21
1 files changed, 7 insertions, 14 deletions
diff --git a/modules/tag/tests/Tag_Test.php b/modules/tag/tests/Tag_Test.php
index c3243145..defc4e89 100644
--- a/modules/tag/tests/Tag_Test.php
+++ b/modules/tag/tests/Tag_Test.php
@@ -19,24 +19,17 @@
*/
class Tag_Test extends Gallery_Unit_Test_Case {
public function create_tag_test() {
- $rand = rand();
- $root = ORM::factory("item", 1);
- $album = album::create($root, $rand, $rand, $rand);
- $tag1 = "tag1";
+ $album = test::random_album();
- tag::add($album, $tag1);
- $tag = ORM::factory("tag")->where("name", "=", $tag1)->find();
+ tag::add($album, "tag1");
+ $tag = ORM::factory("tag")->where("name", "=", "tag1")->find();
$this->assert_true(1, $tag->count);
// Make sure adding the tag again doesn't increase the count
- tag::add($album, $tag1);
- $tag = ORM::factory("tag")->where("name", "=", $tag1)->find();
- $this->assert_true(1, $tag->count);
+ tag::add($album, "tag1");
+ $this->assert_true(1, $tag->reload()->count);
- $rand = rand();
- $album = album::create($root, $rand, $rand, $rand);
- tag::add($album, $tag1);
- $tag = ORM::factory("tag")->where("name", "=", $tag1)->find();
- $this->assert_true(2, $tag->count);
+ tag::add(test::random_album(), "tag1");
+ $this->assert_true(2, $tag->reload()->count);
}
} \ No newline at end of file