From b2af9ed47043ac43d33c9c19db4d29093e3ee600 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Tue, 25 Nov 2008 07:05:03 +0000 Subject: Modify the test controller to call tag_installer::install and uninstall Created the first tag unit test --- modules/tag/tests/Tag_Test.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'modules/tag/tests') diff --git a/modules/tag/tests/Tag_Test.php b/modules/tag/tests/Tag_Test.php index 5286a2fa..989efb3c 100644 --- a/modules/tag/tests/Tag_Test.php +++ b/modules/tag/tests/Tag_Test.php @@ -18,5 +18,25 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class Tag_Test extends Unit_Test_Case { + public function create_tag_test() { + $rand = rand(); + $album = album::create(1, $rand, $rand, $rand); + $tag1 = "tag1"; + + 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); + + $rand = rand(); + $album = album::create(1, $rand, $rand, $rand); + tag::add($album, $tag1); + $tag = ORM::factory("tag")->where("name", $tag1)->find(); + $this->assert_true(2, $tag->count); + } // @todo put some tests here } \ No newline at end of file -- cgit v1.2.3