mirror of
https://github.com/nextcloud/server.git
synced 2026-02-28 20:40:39 -05:00
Merge pull request #44276 from nextcloud/fix/config/string-user-keys
This commit is contained in:
commit
c34e252252
2 changed files with 26 additions and 1 deletions
|
|
@ -339,7 +339,7 @@ class AllConfig implements IConfig {
|
|||
public function getUserKeys($userId, $appName) {
|
||||
$data = $this->getAllUserValues($userId);
|
||||
if (isset($data[$appName])) {
|
||||
return array_keys($data[$appName]);
|
||||
return array_map('strval', array_keys($data[$appName]));
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -277,6 +277,31 @@ class AllConfigTest extends \Test\TestCase {
|
|||
$this->connection->executeUpdate('DELETE FROM `*PREFIX*preferences`');
|
||||
}
|
||||
|
||||
public function testGetUserKeysAllInts() {
|
||||
$config = $this->getConfig();
|
||||
|
||||
// preparation - add something to the database
|
||||
$data = [
|
||||
['userFetch', 'appFetch1', '123', 'value'],
|
||||
['userFetch', 'appFetch1', '456', 'value'],
|
||||
];
|
||||
foreach ($data as $entry) {
|
||||
$this->connection->executeUpdate(
|
||||
'INSERT INTO `*PREFIX*preferences` (`userid`, `appid`, ' .
|
||||
'`configkey`, `configvalue`) VALUES (?, ?, ?, ?)',
|
||||
$entry
|
||||
);
|
||||
}
|
||||
|
||||
$value = $config->getUserKeys('userFetch', 'appFetch1');
|
||||
$this->assertEquals(['123', '456'], $value);
|
||||
$this->assertIsString($value[0]);
|
||||
$this->assertIsString($value[1]);
|
||||
|
||||
// cleanup
|
||||
$this->connection->executeUpdate('DELETE FROM `*PREFIX*preferences`');
|
||||
}
|
||||
|
||||
public function testGetUserValueDefault() {
|
||||
$config = $this->getConfig();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue