diff options
author | cweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2009-10-24 09:05:05 +0000 |
---|---|---|
committer | cweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2009-10-24 09:05:05 +0000 |
commit | 1cf13746273dc0070813e79c90f49d3e6997319f (patch) | |
tree | 898d2701eb35b964fe511777ac14684b6002236c | |
parent | ffa24d7fa5a34bc4f8ed8ceabc6382e120c2a9b8 (diff) | |
download | semanticscuttle-1cf13746273dc0070813e79c90f49d3e6997319f.tar.gz semanticscuttle-1cf13746273dc0070813e79c90f49d3e6997319f.tar.bz2 |
clear votes table before testing votes
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@403 b3834d28-1941-0410-a4f8-b48e95affb8f
-rw-r--r-- | src/SemanticScuttle/Service/Vote.php | 18 | ||||
-rw-r--r-- | tests/VoteTest.php | 1 |
2 files changed, 17 insertions, 2 deletions
diff --git a/src/SemanticScuttle/Service/Vote.php b/src/SemanticScuttle/Service/Vote.php index 4a5baab..e6d021b 100644 --- a/src/SemanticScuttle/Service/Vote.php +++ b/src/SemanticScuttle/Service/Vote.php @@ -163,14 +163,14 @@ class SemanticScuttle_Service_Vote extends SemanticScuttle_DbService '', __LINE__, __FILE__, $query, $this->db ); //FIXME: throw exception - return false; + return null; } $row = $this->db->sql_fetchrow($dbres); $this->db->sql_freeresult($dbres); if (!$row) { - return false; + return null; } return (int)$row['count'] == 1; @@ -282,6 +282,20 @@ class SemanticScuttle_Service_Vote extends SemanticScuttle_DbService } + + /** + * Delete all votes from the database table. + * Used in unit tests. + * + * @return void + */ + public function deleteAll() + { + $query = 'TRUNCATE TABLE `'. $this->getTableName() .'`'; + $this->db->sql_query($query); + } + + } ?>
\ No newline at end of file diff --git a/tests/VoteTest.php b/tests/VoteTest.php index 90fae48..0196071 100644 --- a/tests/VoteTest.php +++ b/tests/VoteTest.php @@ -57,6 +57,7 @@ class VoteTest extends PHPUnit_Framework_TestCase { //FIXME: create true new instance $this->vs = SemanticScuttle_Service_Factory::get('Vote'); + $this->vs->deleteAll(); } |