From 276d7de5b6254222aee828de54f21af6ee4c0a15 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 20 Jan 2010 00:14:05 -0800 Subject: Simplify and update for model based validation. --- modules/tag/tests/Tag_Test.php | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'modules') 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 -- cgit v1.2.3