clear votes table before testing votes
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@403 b3834d28-1941-0410-a4f8-b48e95affb8f
This commit is contained in:
parent
ffa24d7fa5
commit
1cf1374627
@ -163,14 +163,14 @@ class SemanticScuttle_Service_Vote extends SemanticScuttle_DbService
|
|||||||
'', __LINE__, __FILE__, $query, $this->db
|
'', __LINE__, __FILE__, $query, $this->db
|
||||||
);
|
);
|
||||||
//FIXME: throw exception
|
//FIXME: throw exception
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$row = $this->db->sql_fetchrow($dbres);
|
$row = $this->db->sql_fetchrow($dbres);
|
||||||
$this->db->sql_freeresult($dbres);
|
$this->db->sql_freeresult($dbres);
|
||||||
|
|
||||||
if (!$row) {
|
if (!$row) {
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int)$row['count'] == 1;
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@ -57,6 +57,7 @@ class VoteTest extends PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
//FIXME: create true new instance
|
//FIXME: create true new instance
|
||||||
$this->vs = SemanticScuttle_Service_Factory::get('Vote');
|
$this->vs = SemanticScuttle_Service_Factory::get('Vote');
|
||||||
|
$this->vs->deleteAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user