mirror of
https://github.com/friendica/friendica
synced 2025-04-22 17:10:11 +00:00
Introduce HiddenString for Config-Values
This commit is contained in:
parent
f5606fb211
commit
357d9b5108
6 changed files with 121 additions and 24 deletions
|
@ -275,4 +275,38 @@ class ConfigCacheTest extends MockedTest
|
|||
|
||||
$this->assertEmpty($configCache->keyDiff($diffConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the default hiding of passwords inside the cache
|
||||
*/
|
||||
public function testPasswordHide()
|
||||
{
|
||||
$configCache = new ConfigCache([
|
||||
'database' => [
|
||||
'password' => 'supersecure',
|
||||
'username' => 'notsecured',
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertEquals('supersecure', $configCache->get('database', 'password'));
|
||||
$this->assertNotEquals('supersecure', print_r($configCache->get('database', 'password'), true));
|
||||
$this->assertEquals('notsecured', print_r($configCache->get('database', 'username'), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test disabling the hiding of passwords inside the cache
|
||||
*/
|
||||
public function testPasswordShow()
|
||||
{
|
||||
$configCache = new ConfigCache([
|
||||
'database' => [
|
||||
'password' => 'supersecure',
|
||||
'username' => 'notsecured',
|
||||
],
|
||||
], false);
|
||||
|
||||
$this->assertEquals('supersecure', $configCache->get('database', 'password'));
|
||||
$this->assertEquals('supersecure', print_r($configCache->get('database', 'password'), true));
|
||||
$this->assertEquals('notsecured', print_r($configCache->get('database', 'username'), true));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue