From bb5205053e9ae9e584df9715dafd85f9c576f248 Mon Sep 17 00:00:00 2001 From: cweiske Date: Wed, 28 Oct 2009 22:15:14 +0000 Subject: implement rewriteVotings() and unittest the method git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@448 b3834d28-1941-0410-a4f8-b48e95affb8f --- tests/VoteTest.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'tests') diff --git a/tests/VoteTest.php b/tests/VoteTest.php index 2579709..b9a859d 100644 --- a/tests/VoteTest.php +++ b/tests/VoteTest.php @@ -329,6 +329,34 @@ class VoteTest extends TestBase $this->assertEquals(-1, $this->vs->getVote($bid, $uid)); } + + + /** + * Test that rewriting votings does work + * + * @return void + */ + public function testRewriteVotings() + { + $uid = 1; + $bid = $this->addBookmark(); + $this->assertTrue($this->vs->vote($bid, $uid, 1)); + + $bm = $this->bs->getBookmark($bid); + $this->assertEquals(1, $bm['bVoting']); + + $this->vs->deleteAll(); + //we assume that $vs->deleteAll() does *not* reset + //voting in bookmarks table + $bm = $this->bs->getBookmark($bid); + $this->assertEquals(1, $bm['bVoting']); + + $this->vs->rewriteVotings(); + $bm = $this->bs->getBookmark($bid); + //now it should be reset to 0 + $this->assertEquals(0, $bm['bVoting']); + } + }//class VoteTest extends TestBase -- cgit v1.2.3