$this->systemConfig->expects($this->any())
->method('getValue')
->willReturnMap($systemConfigMap);
+ $this->appConfig->expects($this->any())
+ ->method('getValues')
+ ->willReturnMap($appConfig);
} else {
$this->systemConfig->expects($this->any())
->method('getFilteredValue')
->willReturnMap($systemConfigMap);
+ $this->appConfig->expects($this->any())
+ ->method('getFilteredValues')
+ ->willReturnMap($appConfig);
}
$this->appConfig->expects($this->any())
*/
namespace Test;
+use OCP\IConfig;
/**
* Class AppConfigTest
$this->assertEquals($expected, $values);
}
+ public function testGetFilteredValues() {
+ /** @var \OC\AppConfig|\PHPUnit_Framework_MockObject_MockObject $config */
+ $config = $this->getMockBuilder(\OC\AppConfig::class)
+ ->setConstructorArgs([\OC::$server->getDatabaseConnection()])
+ ->setMethods(['getValues'])
+ ->getMock();
+
+ $config->expects($this->once())
+ ->method('getValues')
+ ->with('user_ldap', false)
+ ->willReturn([
+ 'ldap_agent_password' => 'secret',
+ 'ldap_dn' => 'dn',
+ ]);
+
+ $values = $config->getFilteredValues('user_ldap');
+ $this->assertEquals([
+ 'ldap_agent_password' => IConfig::SENSITIVE_VALUE,
+ 'ldap_dn' => 'dn',
+ ], $values);
+ }
+
public function testSettingConfigParallel() {
$appConfig1 = new \OC\AppConfig(\OC::$server->getDatabaseConnection());
$appConfig2 = new \OC\AppConfig(\OC::$server->getDatabaseConnection());