diff options
-rw-r--r-- | modules/gallery_unit_test/controllers/test.php | 3 | ||||
-rw-r--r-- | modules/tag/tests/Tag_Test.php | 20 |
2 files changed, 23 insertions, 0 deletions
diff --git a/modules/gallery_unit_test/controllers/test.php b/modules/gallery_unit_test/controllers/test.php index 203edcba..92985a26 100644 --- a/modules/gallery_unit_test/controllers/test.php +++ b/modules/gallery_unit_test/controllers/test.php @@ -60,16 +60,19 @@ class Test_Controller extends Controller { // We probably don't want to uninstall and reinstall the core every time, but let's start off // this way. Uninstall modules first and core last. Ignore errors during uninstall. + // @todo make this more dynamic try { comment_installer::uninstall(); user_installer::uninstall(); core_installer::uninstall(); + tag_installer::uninstall(); } catch (Exception $e) { } core_installer::install(); user_installer::install(); comment_installer::install(); + tag_installer::install(); print new Unit_Test(); } 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 |