summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2024-03-18 14:51:35 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-03-19 17:32:57 +0000
commit112b8bcbfb5f9abdfa40f3fa273ae695dabc9c20 (patch)
tree1c7db6d395dd4eff2cd4fb85d6e4c67479abd3b0 /tests
parentf8ad4ae852ebd456c2cfd497c2fece6a574ec9d9 (diff)
downloadnextcloud-server-112b8bcbfb5f9abdfa40f3fa273ae695dabc9c20.tar.gz
nextcloud-server-112b8bcbfb5f9abdfa40f3fa273ae695dabc9c20.zip
fix(config): Make sure user keys are strings
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/AllConfigTest.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/lib/AllConfigTest.php b/tests/lib/AllConfigTest.php
index fca4e8d8308..540eff42e51 100644
--- a/tests/lib/AllConfigTest.php
+++ b/tests/lib/AllConfigTest.php
@@ -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();