aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2025-06-05 11:08:02 +0200
committerCôme Chilliet <come.chilliet@nextcloud.com>2025-06-05 17:58:55 +0200
commit89f51a8f4eee8ffa42562f55819eeac652f70457 (patch)
tree7631eb482a04c2110e109495eee73c37b590b87c /tests/lib
parentc6f2eff7f7eedc2aed7536e05cd8dbfab16f3a82 (diff)
downloadnextcloud-server-89f51a8f4eee8ffa42562f55819eeac652f70457.tar.gz
nextcloud-server-89f51a8f4eee8ffa42562f55819eeac652f70457.zip
chore(tests): Add test for AppConfig::getAppInstalledVersions
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/AppConfigTest.php24
1 files changed, 19 insertions, 5 deletions
diff --git a/tests/lib/AppConfigTest.php b/tests/lib/AppConfigTest.php
index faeaa4c4560..4acb83ece14 100644
--- a/tests/lib/AppConfigTest.php
+++ b/tests/lib/AppConfigTest.php
@@ -38,7 +38,7 @@ class AppConfigTest extends TestCase {
private static array $baseStruct =
[
'testapp' => [
- 'enabled' => ['enabled', 'true'],
+ 'enabled' => ['enabled', 'yes'],
'installed_version' => ['installed_version', '1.2.3'],
'depends_on' => ['depends_on', 'someapp'],
'deletethis' => ['deletethis', 'deletethis'],
@@ -49,11 +49,12 @@ class AppConfigTest extends TestCase {
'otherkey' => ['otherkey', 'othervalue']
],
'123456' => [
- 'enabled' => ['enabled', 'true'],
+ 'enabled' => ['enabled', 'yes'],
'key' => ['key', 'value']
],
'anotherapp' => [
- 'enabled' => ['enabled', 'false'],
+ 'enabled' => ['enabled', 'no'],
+ 'installed_version' => ['installed_version', '3.2.1'],
'key' => ['key', 'value']
],
'non-sensitive-app' => [
@@ -211,6 +212,19 @@ class AppConfigTest extends TestCase {
$this->assertEqualsCanonicalizing(array_keys(self::$baseStruct), $config->getApps());
}
+ public function testGetAppInstalledVersions(): void {
+ $config = $this->generateAppConfig(false);
+
+ $this->assertEquals(
+ ['testapp' => '1.2.3', 'anotherapp' => '3.2.1'],
+ $config->getAppInstalledVersions(false)
+ );
+ $this->assertEquals(
+ ['testapp' => '1.2.3'],
+ $config->getAppInstalledVersions(true)
+ );
+ }
+
/**
* returns list of app and their keys
*
@@ -410,7 +424,7 @@ class AppConfigTest extends TestCase {
public function testSearchValues(): void {
$config = $this->generateAppConfig();
- $this->assertEqualsCanonicalizing(['testapp' => 'true', '123456' => 'true', 'anotherapp' => 'false'], $config->searchValues('enabled'));
+ $this->assertEqualsCanonicalizing(['testapp' => 'yes', '123456' => 'yes', 'anotherapp' => 'no'], $config->searchValues('enabled'));
}
public function testGetValueString(): void {
@@ -1322,7 +1336,7 @@ class AppConfigTest extends TestCase {
$config = $this->generateAppConfig();
$config->deleteKey('anotherapp', 'key');
$status = $config->statusCache();
- $this->assertEqualsCanonicalizing(['enabled' => 'false'], $status['fastCache']['anotherapp']);
+ $this->assertEqualsCanonicalizing(['enabled' => 'no', 'installed_version' => '3.2.1'], $status['fastCache']['anotherapp']);
}
public function testDeleteKeyDatabase(): void {