]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix tests 3400/head
authorJoas Schilling <coding@schilljs.com>
Thu, 12 Jan 2017 09:49:22 +0000 (10:49 +0100)
committerJoas Schilling <coding@schilljs.com>
Tue, 7 Feb 2017 16:00:10 +0000 (17:00 +0100)
Signed-off-by: Joas Schilling <coding@schilljs.com>
lib/private/SystemConfig.php
tests/Core/Command/Config/ListConfigsTest.php
tests/lib/AppConfigTest.php

index 1029a6619ffd2a920f83b0bfadfb71f39d920aab..e5f1adaf00464cbc08ec8f9de164218617f13c02 100644 (file)
@@ -44,7 +44,6 @@ class SystemConfig {
                'passwordsalt' => true,
                'secret' => true,
                'updater.secret' => true,
-               'ldap_agent_password' => true,
                'proxyuserpwd' => true,
                'log.condition' => [
                        'shared_secret' => true,
index 0f170cee840e4956ca437a2791ff7380e841bc5c..861c1f59d5ea01fd4b10cbc9ad4f462bc4521c96 100644 (file)
@@ -285,10 +285,16 @@ class ListConfigsTest extends TestCase {
                        $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())
index c4da7507752322dee20e57118d049d82eb24e519..fed929352d3003d74116dfa88837d755959d219e 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 namespace Test;
+use OCP\IConfig;
 
 /**
  * Class AppConfigTest
@@ -305,6 +306,28 @@ class AppConfigTest extends TestCase {
                $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());