Merge pull request #4328 from owncloud/cleanupdb_kondou

Clean up DB, after we're done with testing Preferences
This commit is contained in:
Morris Jobke 2013-08-08 01:36:10 -07:00
commit 35e1d8b265
1 changed files with 8 additions and 3 deletions

View File

@ -7,7 +7,7 @@
*/
class Test_Preferences extends PHPUnit_Framework_TestCase {
private function fillDb() {
public static function setUpBeforeClass() {
$query = \OC_DB::prepare('INSERT INTO `*PREFIX*preferences` VALUES(?, ?, ?, ?)');
$query->execute(array("Someuser", "someapp", "somekey", "somevalue"));
@ -28,9 +28,14 @@ class Test_Preferences extends PHPUnit_Framework_TestCase {
$query->execute(array("Deleteuser", "someapp", "somekey", "somevalue"));
}
public function testGetUsers() {
$this->fillDb();
public static function tearDownAfterClass() {
$query = \OC_DB::prepare('DELETE FROM `*PREFIX*preferences` WHERE `userid` = ?');
$query->execute(array('Someuser'));
$query->execute(array('Anotheruser'));
$query->execute(array('Anuser'));
}
public function testGetUsers() {
$query = \OC_DB::prepare('SELECT DISTINCT `userid` FROM `*PREFIX*preferences`');
$result = $query->execute();
$expected = array();