*/
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"));
$query->execute(array("Deleteuser", "someapp", "somekey", "somevalue"));
}
- private function cleanDb() {
+ public static function tearDownAfterClass() {
$query = \OC_DB::prepare('DELETE FROM `*PREFIX*preferences` WHERE `user` = ?');
$query->execute(array('Someuser'));
$query->execute(array('Anotheruser'));
}
public function testGetUsers() {
- $this->fillDb();
-
$query = \OC_DB::prepare('SELECT DISTINCT `userid` FROM `*PREFIX*preferences`');
$result = $query->execute();
$expected = array();
$query = \OC_DB::prepare('SELECT `configvalue` FROM `*PREFIX*preferences` WHERE `appid` = ?');
$result = $query->execute(array('someapp'));
$this->assertEquals(0, $result->numRows());
-
- $this->cleanDb();
}
}