summaryrefslogtreecommitdiff
path: root/tests/VoteTest.php
diff options
context:
space:
mode:
authorcweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-10-28 22:15:14 +0000
committercweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-10-28 22:15:14 +0000
commitbb5205053e9ae9e584df9715dafd85f9c576f248 (patch)
tree78cfab0b0f18d4593e0913ee893c4047dcebfb45 /tests/VoteTest.php
parent03bc498effbd7d009cbfa15f765a8d4934e52ea1 (diff)
downloadsemanticscuttle-bb5205053e9ae9e584df9715dafd85f9c576f248.tar.gz
semanticscuttle-bb5205053e9ae9e584df9715dafd85f9c576f248.tar.bz2
implement rewriteVotings() and unittest the method
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@448 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'tests/VoteTest.php')
-rw-r--r--tests/VoteTest.php28
1 files changed, 28 insertions, 0 deletions
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