]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
clear votes table before testing votes
authorcweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>
Sat, 24 Oct 2009 09:05:05 +0000 (09:05 +0000)
committercweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>
Sat, 24 Oct 2009 09:05:05 +0000 (09:05 +0000)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@403 b3834d28-1941-0410-a4f8-b48e95affb8f

src/SemanticScuttle/Service/Vote.php
tests/VoteTest.php

index 4a5baab22983c365424e9ff8d32334cffa9236b4..e6d021b1d256ff0d3f29ea29df2b69be90aee869 100644 (file)
@@ -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
index 90fae48191707e965976528dc50db65481940fa1..01960713ed235f728691718e15ccc7cf4e673198 100644 (file)
@@ -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();
     }