adapt minor changers / fix tests

This commit is contained in:
Philipp 2023-03-27 19:35:02 +02:00
parent 73aaedac97
commit c2d11328cc
No known key found for this signature in database
GPG Key ID: 24A7501396EB5432
3 changed files with 6 additions and 6 deletions

View File

@ -59,12 +59,12 @@ interface IManageConfigValues
public function get(string $cat, string $key = null, $default_value = null); public function get(string $cat, string $key = null, $default_value = null);
/** /**
* Returns true, if the current config cannot be changed * Returns true, if the current config can be changed
* *
* @param string $cat The category of the configuration value * @param string $cat The category of the configuration value
* @param string $key The configuration key to query * @param string $key The configuration key to query
* *
* @return bool true, if set is disabled * @return bool true, if writing is possible
*/ */
public function isWritable(string $cat, string $key): bool; public function isWritable(string $cat, string $key): bool;

View File

@ -146,7 +146,7 @@ class Storage extends BaseAdmin
'$noconfig' => DI::l10n()->t('This backend doesn\'t have custom settings'), '$noconfig' => DI::l10n()->t('This backend doesn\'t have custom settings'),
'$form_security_token' => self::getFormSecurityToken("admin_storage"), '$form_security_token' => self::getFormSecurityToken("admin_storage"),
'$storagebackend_ro_txt' => !DI::config()->isWritable('storage', 'name') ? DI::l10n()->t('Changing the current backend is prohibited because it is set by an environment variable') : '', '$storagebackend_ro_txt' => !DI::config()->isWritable('storage', 'name') ? DI::l10n()->t('Changing the current backend is prohibited because it is set by an environment variable') : '',
'$is_writable' => DI::config()->isWritable('storage', 'name'), '$is_writable' => DI::config()->isWritable('storage', 'name'),
'$storagebackend' => $current_storage_backend instanceof ICanWriteToStorage ? $current_storage_backend::getName() : DI::l10n()->t('Database (legacy)'), '$storagebackend' => $current_storage_backend instanceof ICanWriteToStorage ? $current_storage_backend::getName() : DI::l10n()->t('Database (legacy)'),
'$availablestorageforms' => $available_storage_forms, '$availablestorageforms' => $available_storage_forms,
]); ]);

View File

@ -613,11 +613,11 @@ class ConfigTest extends DatabaseTest
} }
/** /**
* Tests if environment variables leads to a disabled set * Tests if environment variables can change the permission to write a config key
* *
* @dataProvider dataEnv * @dataProvider dataEnv
*/ */
public function testIsSetDisabled(array $data, array $server, array $assertDisabled) public function testIsWritable(array $data, array $server, array $assertDisabled)
{ {
$this->setConfigFile('static' . DIRECTORY_SEPARATOR . 'env.config.php', true); $this->setConfigFile('static' . DIRECTORY_SEPARATOR . 'env.config.php', true);
$this->loadDirectFixture($this->configToDbArray($data), $this->getDbInstance()); $this->loadDirectFixture($this->configToDbArray($data), $this->getDbInstance());
@ -628,7 +628,7 @@ class ConfigTest extends DatabaseTest
foreach ($data as $category => $keyvalues) { foreach ($data as $category => $keyvalues) {
foreach ($keyvalues as $key => $value) { foreach ($keyvalues as $key => $value) {
if (!empty($assertDisabled[$category][$key])) { if (empty($assertDisabled[$category][$key])) {
static::assertTrue($config->isWritable($category, $key), sprintf('%s.%s is not true', $category, $key)); static::assertTrue($config->isWritable($category, $key), sprintf('%s.%s is not true', $category, $key));
} else { } else {
static::assertFalse($config->isWritable($category, $key), sprintf('%s.%s is not false', $category, $key)); static::assertFalse($config->isWritable($category, $key), sprintf('%s.%s is not false', $category, $key));