]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix personal security section tests 15789/head
authorChristoph Wurst <christoph@winzerhof-wurst.at>
Wed, 29 May 2019 11:10:07 +0000 (13:10 +0200)
committerChristoph Wurst <christoph@winzerhof-wurst.at>
Wed, 29 May 2019 11:10:07 +0000 (13:10 +0200)
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
tests/lib/Settings/Personal/SecurityTest.php

index dcef9ab0d7d573452969236b2b6bbd1be1cf4815..ae9d59e0d44e0eb57c5453456b24590ecba31517 100644 (file)
@@ -31,6 +31,7 @@ use OC\Authentication\TwoFactorAuth\Manager as TwoFactorManager;
 use OC\Authentication\TwoFactorAuth\ProviderLoader;
 use OC\Settings\Personal\Security;
 use OCP\AppFramework\Http\TemplateResponse;
+use OCP\IConfig;
 use OCP\IInitialStateService;
 use OCP\ISession;
 use OCP\IUser;
@@ -59,6 +60,9 @@ class SecurityTest extends TestCase {
        /** @var ISession|MockObject */
        private $session;
 
+       /** @var IConfig|MockObject */
+       private $config;
+
        /** @var IInitialStateService|MockObject */
        private $initialStateService;
 
@@ -76,6 +80,7 @@ class SecurityTest extends TestCase {
                $this->authTokenProvider = $this->createMock(IAuthTokenProvider::class);
                $this->providerLoader = $this->createMock(ProviderLoader::class);
                $this->userSession = $this->createMock(IUserSession::class);
+               $this->config = $this->createMock(IConfig::class);
                $this->session = $this->createMock(ISession::class);
                $this->initialStateService = $this->createMock(IInitialStateService::class);
                $this->uid = 'test123';
@@ -87,6 +92,7 @@ class SecurityTest extends TestCase {
                        $this->providerLoader,
                        $this->userSession,
                        $this->session,
+                       $this->config,
                        $this->initialStateService,
                        $this->uid
                );
@@ -152,6 +158,15 @@ class SecurityTest extends TestCase {
                        ->method('getProviders')
                        ->with($user)
                        ->willReturn([]);
+               $this->config->expects($this->once())
+                       ->method('getUserValue')
+                       ->with(
+                               $this->uid,
+                               'accessibility',
+                               'theme',
+                               false
+                       )
+                       ->willReturn(false);
 
                $form = $this->section->getForm();
 
@@ -160,6 +175,7 @@ class SecurityTest extends TestCase {
                        'twoFactorProviderData' => [
                                'providers' => [],
                        ],
+                       'themedark' => false,
                ]);
                $this->assertEquals($expected, $form);
        }