Add a lot of users for testing

This commit is contained in:
Joas Schilling 2014-05-21 13:17:29 +02:00
parent 4fbfe077fb
commit 66f94273c6
1 changed files with 15 additions and 1 deletions

View File

@ -192,8 +192,22 @@ class Test_Preferences_Object extends PHPUnit_Framework_TestCase {
$query->execute(array('AUser', 'testGetUserValues', 'somekey', 'somevalue'));
$preferences = new OC\Preferences(\OC_DB::getConnection());
$values = $preferences->getValueForUsers('testGetUserValues', 'somekey', array('SomeUser', 'AnotherUser', 'NoValueSet'));
$users = array('SomeUser', 'AnotherUser', 'NoValueSet');
$values = $preferences->getValueForUsers('testGetUserValues', 'somekey', $users);
$this->assertUserValues($values);
// Add a lot of users so the array is chunked
for ($i = 1; $i <= 75; $i++) {
array_unshift($users, 'NoValueBefore#' . $i);
array_push($users, 'NoValueAfter#' . $i);
}
$values = $preferences->getValueForUsers('testGetUserValues', 'somekey', $users);
$this->assertUserValues($values);
}
protected function assertUserValues($values) {
$this->assertEquals(2, sizeof($values));
$this->assertArrayHasKey('SomeUser', $values);