Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2019-09-17 17:33:27 +0300
committernpmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>2019-09-28 12:39:28 +0300
commitde6940352a2f708376219a89ec84a8e6d25ca59e (patch)
tree459bacfc183b24d611be1877fbe22bbcd4efb1d6 /tests/lib/Settings
parentc8cd607681ac128228f57114ce14dd67ab05de04 (diff)
Move settings to an app
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at> Signed-off-by: npmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>
Diffstat (limited to 'tests/lib/Settings')
-rw-r--r--tests/lib/Settings/Admin/MailTest.php134
-rw-r--r--tests/lib/Settings/Admin/SecurityTest.php149
-rw-r--r--tests/lib/Settings/Admin/ServerTest.php85
-rw-r--r--tests/lib/Settings/Admin/SharingTest.php271
-rw-r--r--tests/lib/Settings/ManagerTest.php9
-rw-r--r--tests/lib/Settings/Personal/SecurityTest.php120
-rw-r--r--tests/lib/Settings/SectionTest.php2
7 files changed, 4 insertions, 766 deletions
diff --git a/tests/lib/Settings/Admin/MailTest.php b/tests/lib/Settings/Admin/MailTest.php
deleted file mode 100644
index 1a1d090418e..00000000000
--- a/tests/lib/Settings/Admin/MailTest.php
+++ /dev/null
@@ -1,134 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
- *
- * @author Lukas Reschke <lukas@statuscode.ch>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace Test\Settings\Admin;
-
-use OC\Settings\Admin\Additional;
-use OC\Settings\Admin\Mail;
-use OCP\AppFramework\Http\TemplateResponse;
-use OCP\IConfig;
-use Test\TestCase;
-
-class MailTest extends TestCase {
- /** @var Additional */
- private $admin;
- /** @var IConfig */
- private $config;
-
- public function setUp() {
- parent::setUp();
- $this->config = $this->getMockBuilder(IConfig::class)->getMock();
-
- $this->admin = new Mail(
- $this->config
- );
- }
-
- public function testGetForm() {
- $this->config
- ->expects($this->at(0))
- ->method('getSystemValue')
- ->with('mail_domain', '')
- ->willReturn('mx.nextcloud.com');
- $this->config
- ->expects($this->at(1))
- ->method('getSystemValue')
- ->with('mail_from_address', '')
- ->willReturn('no-reply@nextcloud.com');
- $this->config
- ->expects($this->at(2))
- ->method('getSystemValue')
- ->with('mail_smtpmode', '')
- ->willReturn('smtp');
- $this->config
- ->expects($this->at(3))
- ->method('getSystemValue')
- ->with('mail_smtpsecure', '')
- ->willReturn(true);
- $this->config
- ->expects($this->at(4))
- ->method('getSystemValue')
- ->with('mail_smtphost', '')
- ->willReturn('smtp.nextcloud.com');
- $this->config
- ->expects($this->at(5))
- ->method('getSystemValue')
- ->with('mail_smtpport', '')
- ->willReturn(25);
- $this->config
- ->expects($this->at(6))
- ->method('getSystemValue')
- ->with('mail_smtpauthtype', '')
- ->willReturn('login');
- $this->config
- ->expects($this->at(7))
- ->method('getSystemValue')
- ->with('mail_smtpauth', false)
- ->willReturn(true);
- $this->config
- ->expects($this->at(8))
- ->method('getSystemValue')
- ->with('mail_smtpname', '')
- ->willReturn('smtp.sender.com');
- $this->config
- ->expects($this->at(9))
- ->method('getSystemValue')
- ->with('mail_smtppassword', '')
- ->willReturn('mypassword');
- $this->config
- ->expects($this->at(10))
- ->method('getSystemValue')
- ->with('mail_sendmailmode', 'smtp')
- ->willReturn('smtp');
-
- $expected = new TemplateResponse(
- 'settings',
- 'settings/admin/additional-mail',
- [
- 'sendmail_is_available' => (bool) \OC_Helper::findBinaryPath('sendmail'),
- 'mail_domain' => 'mx.nextcloud.com',
- 'mail_from_address' => 'no-reply@nextcloud.com',
- 'mail_smtpmode' => 'smtp',
- 'mail_smtpsecure' => true,
- 'mail_smtphost' => 'smtp.nextcloud.com',
- 'mail_smtpport' => 25,
- 'mail_smtpauthtype' => 'login',
- 'mail_smtpauth' => true,
- 'mail_smtpname' => 'smtp.sender.com',
- 'mail_smtppassword' => '********',
- 'mail_sendmailmode' => 'smtp',
- ],
- ''
- );
-
- $this->assertEquals($expected, $this->admin->getForm());
- }
-
- public function testGetSection() {
- $this->assertSame('server', $this->admin->getSection());
- }
-
- public function testGetPriority() {
- $this->assertSame(10, $this->admin->getPriority());
- }
-}
diff --git a/tests/lib/Settings/Admin/SecurityTest.php b/tests/lib/Settings/Admin/SecurityTest.php
deleted file mode 100644
index 6a9d84bd40d..00000000000
--- a/tests/lib/Settings/Admin/SecurityTest.php
+++ /dev/null
@@ -1,149 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
- *
- * @author Lukas Reschke <lukas@statuscode.ch>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace Test\Settings\Admin;
-
-use OC\Authentication\TwoFactorAuth\MandatoryTwoFactor;
-use OC\Encryption\Manager;
-use OC\Settings\Admin\Security;
-use OCP\AppFramework\Http\TemplateResponse;
-use OCP\IInitialStateService;
-use OCP\IUserManager;
-use PHPUnit\Framework\MockObject\MockObject;
-use Test\TestCase;
-
-class SecurityTest extends TestCase {
- /** @var Security */
- private $admin;
- /** @var Manager */
- private $manager;
- /** @var IUserManager */
- private $userManager;
- /** @var MandatoryTwoFactor|MockObject */
- private $mandatoryTwoFactor;
- /** @var IInitialStateService|MockObject */
- private $initialState;
-
- public function setUp() {
- parent::setUp();
- $this->manager = $this->getMockBuilder('\OC\Encryption\Manager')->disableOriginalConstructor()->getMock();
- $this->userManager = $this->getMockBuilder(IUserManager::class)->getMock();
- $this->mandatoryTwoFactor = $this->createMock(MandatoryTwoFactor::class);
- $this->initialState = $this->createMock(IInitialStateService::class);
-
- $this->admin = new Security(
- $this->manager,
- $this->userManager,
- $this->mandatoryTwoFactor,
- $this->initialState
- );
- }
-
- /**
- * @return array
- */
- public function encryptionSettingsProvider() {
- return [
- [true],
- [false],
- ];
- }
-
- /**
- * @dataProvider encryptionSettingsProvider
- * @param bool $enabled
- */
- public function testGetFormWithOnlyOneBackend($enabled) {
- $this->manager
- ->expects($this->once())
- ->method('isEnabled')
- ->willReturn($enabled);
- $this->manager
- ->expects($this->once())
- ->method('isReady')
- ->willReturn($enabled);
- $this->manager
- ->expects($this->once())
- ->method('getEncryptionModules')
- ->willReturn([]);
- $this->userManager
- ->expects($this->once())
- ->method('getBackends')
- ->willReturn(['entry']);
- $expected = new TemplateResponse(
- 'settings',
- 'settings/admin/security',
- [
- 'encryptionEnabled' => $enabled,
- 'encryptionReady' => $enabled,
- 'externalBackendsEnabled' => false,
- 'encryptionModules' => []
- ],
- ''
- );
- $this->assertEquals($expected, $this->admin->getForm());
- }
-
- /**
- * @dataProvider encryptionSettingsProvider
- * @param bool $enabled
- */
- public function testGetFormWithMultipleBackends($enabled) {
- $this->manager
- ->expects($this->once())
- ->method('isEnabled')
- ->willReturn($enabled);
- $this->manager
- ->expects($this->once())
- ->method('isReady')
- ->willReturn($enabled);
- $this->manager
- ->expects($this->once())
- ->method('getEncryptionModules')
- ->willReturn([]);
- $this->userManager
- ->expects($this->once())
- ->method('getBackends')
- ->willReturn(['entry', 'entry']);
- $expected = new TemplateResponse(
- 'settings',
- 'settings/admin/security',
- [
- 'encryptionEnabled' => $enabled,
- 'encryptionReady' => $enabled,
- 'externalBackendsEnabled' => true,
- 'encryptionModules' => []
- ],
- ''
- );
- $this->assertEquals($expected, $this->admin->getForm());
- }
-
- public function testGetSection() {
- $this->assertSame('security', $this->admin->getSection());
- }
-
- public function testGetPriority() {
- $this->assertSame(10, $this->admin->getPriority());
- }
-}
diff --git a/tests/lib/Settings/Admin/ServerTest.php b/tests/lib/Settings/Admin/ServerTest.php
deleted file mode 100644
index adf8ef4f363..00000000000
--- a/tests/lib/Settings/Admin/ServerTest.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
- *
- * @author Lukas Reschke <lukas@statuscode.ch>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace Test\Settings\Admin;
-
-use OC\Settings\Admin\Server;
-use OCP\AppFramework\Http\TemplateResponse;
-use OCP\IConfig;
-use Test\TestCase;
-
-class ServerTest extends TestCase {
- /** @var Server */
- private $admin;
- /** @var IConfig */
- private $config;
-
- public function setUp() {
- parent::setUp();
- $this->config = $this->createMock(IConfig::class);
-
- $this->admin = new Server(
- $this->config
- );
- }
-
- public function testGetForm() {
- $this->config
- ->expects($this->at(0))
- ->method('getAppValue')
- ->with('core', 'backgroundjobs_mode', 'ajax')
- ->willReturn('ajax');
- $this->config
- ->expects($this->at(1))
- ->method('getAppValue')
- ->with('core', 'lastcron', false)
- ->willReturn(false);
- $this->config
- ->expects($this->at(2))
- ->method('getAppValue')
- ->with('core', 'cronErrors')
- ->willReturn('');
- $expected = new TemplateResponse(
- 'settings',
- 'settings/admin/server',
- [
- 'backgroundjobs_mode' => 'ajax',
- 'lastcron' => false,
- 'cronErrors' => '',
- 'cli_based_cron_possible' => true,
- 'cli_based_cron_user' => function_exists('posix_getpwuid') ? posix_getpwuid(fileowner(\OC::$configDir . 'config.php'))['name'] : '', // to not explode here because of posix extension not being disabled - which is already checked in the line above
- ],
- ''
- );
-
- $this->assertEquals($expected, $this->admin->getForm());
- }
-
- public function testGetSection() {
- $this->assertSame('server', $this->admin->getSection());
- }
-
- public function testGetPriority() {
- $this->assertSame(0, $this->admin->getPriority());
- }
-}
diff --git a/tests/lib/Settings/Admin/SharingTest.php b/tests/lib/Settings/Admin/SharingTest.php
deleted file mode 100644
index c40ff98a869..00000000000
--- a/tests/lib/Settings/Admin/SharingTest.php
+++ /dev/null
@@ -1,271 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
- *
- * @author Lukas Reschke <lukas@statuscode.ch>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace Test\Settings\Admin;
-
-use OC\Settings\Admin\Sharing;
-use OCP\AppFramework\Http\TemplateResponse;
-use OCP\Constants;
-use OCP\IConfig;
-use OCP\IL10N;
-use OCP\L10N\IFactory;
-use OCP\Share\IManager;
-use Test\TestCase;
-
-class SharingTest extends TestCase {
- /** @var Sharing */
- private $admin;
- /** @var IConfig */
- private $config;
- /** @var IL10N|\PHPUnit_Framework_MockObject_MockObject */
- private $l10n;
- /** @var IManager|\PHPUnit_Framework_MockObject_MockObject */
- private $shareManager;
-
- public function setUp() {
- parent::setUp();
- $this->config = $this->getMockBuilder(IConfig::class)->getMock();
- $this->l10n = $this->getMockBuilder(IL10N::class)->getMock();
-
- $l10Factory = $this->createMock(IFactory::class);
- $l10Factory->method('get')
- ->willReturn($this->l10n);
-
- $this->shareManager = $this->getMockBuilder(IManager::class)->getMock();
-
- $this->admin = new Sharing(
- $this->config,
- $l10Factory,
- $this->shareManager
- );
- }
-
- public function testGetFormWithoutExcludedGroups() {
- $this->config
- ->expects($this->at(0))
- ->method('getAppValue')
- ->with('core', 'shareapi_exclude_groups_list', '')
- ->willReturn('');
- $this->config
- ->expects($this->at(1))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_group_sharing', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(2))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_links', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(3))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_public_upload', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(4))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_resharing', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(5))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(6))
- ->method('getAppValue')
- ->with('core', 'shareapi_enabled', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(7))
- ->method('getAppValue')
- ->with('core', 'shareapi_default_expire_date', 'no')
- ->willReturn('no');
- $this->config
- ->expects($this->at(8))
- ->method('getAppValue')
- ->with('core', 'shareapi_expire_after_n_days', '7')
- ->willReturn('7');
- $this->config
- ->expects($this->at(9))
- ->method('getAppValue')
- ->with('core', 'shareapi_enforce_expire_date', 'no')
- ->willReturn('no');
- $this->config
- ->expects($this->at(10))
- ->method('getAppValue')
- ->with('core', 'shareapi_exclude_groups', 'no')
- ->willReturn('no');
- $this->config
- ->expects($this->at(11))
- ->method('getAppValue')
- ->with('core', 'shareapi_public_link_disclaimertext', null)
- ->willReturn('Lorem ipsum');
- $this->config
- ->expects($this->at(12))
- ->method('getAppValue')
- ->with('core', 'shareapi_enable_link_password_by_default', 'no')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(13))
- ->method('getAppValue')
- ->with('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL)
- ->willReturn(Constants::PERMISSION_ALL);
-
- $expected = new TemplateResponse(
- 'settings',
- 'settings/admin/sharing',
- [
- 'allowGroupSharing' => 'yes',
- 'allowLinks' => 'yes',
- 'allowPublicUpload' => 'yes',
- 'allowResharing' => 'yes',
- 'allowShareDialogUserEnumeration' => 'yes',
- 'enforceLinkPassword' => false,
- 'onlyShareWithGroupMembers' => false,
- 'shareAPIEnabled' => 'yes',
- 'shareDefaultExpireDateSet' => 'no',
- 'shareExpireAfterNDays' => '7',
- 'shareEnforceExpireDate' => 'no',
- 'shareExcludeGroups' => false,
- 'shareExcludedGroupsList' => '',
- 'publicShareDisclaimerText' => 'Lorem ipsum',
- 'enableLinkPasswordByDefault' => 'yes',
- 'shareApiDefaultPermissions' => Constants::PERMISSION_ALL,
- 'shareApiDefaultPermissionsCheckboxes' => $this->invokePrivate($this->admin, 'getSharePermissionList', [])
- ],
- ''
- );
-
- $this->assertEquals($expected, $this->admin->getForm());
- }
-
- public function testGetFormWithExcludedGroups() {
- $this->config
- ->expects($this->at(0))
- ->method('getAppValue')
- ->with('core', 'shareapi_exclude_groups_list', '')
- ->willReturn('["NoSharers","OtherNoSharers"]');
- $this->config
- ->expects($this->at(1))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_group_sharing', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(2))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_links', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(3))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_public_upload', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(4))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_resharing', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(5))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(6))
- ->method('getAppValue')
- ->with('core', 'shareapi_enabled', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(7))
- ->method('getAppValue')
- ->with('core', 'shareapi_default_expire_date', 'no')
- ->willReturn('no');
- $this->config
- ->expects($this->at(8))
- ->method('getAppValue')
- ->with('core', 'shareapi_expire_after_n_days', '7')
- ->willReturn('7');
- $this->config
- ->expects($this->at(9))
- ->method('getAppValue')
- ->with('core', 'shareapi_enforce_expire_date', 'no')
- ->willReturn('no');
- $this->config
- ->expects($this->at(10))
- ->method('getAppValue')
- ->with('core', 'shareapi_exclude_groups', 'no')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(11))
- ->method('getAppValue')
- ->with('core', 'shareapi_public_link_disclaimertext', null)
- ->willReturn('Lorem ipsum');
- $this->config
- ->expects($this->at(12))
- ->method('getAppValue')
- ->with('core', 'shareapi_enable_link_password_by_default', 'no')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(13))
- ->method('getAppValue')
- ->with('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL)
- ->willReturn(Constants::PERMISSION_ALL);
-
-
- $expected = new TemplateResponse(
- 'settings',
- 'settings/admin/sharing',
- [
- 'allowGroupSharing' => 'yes',
- 'allowLinks' => 'yes',
- 'allowPublicUpload' => 'yes',
- 'allowResharing' => 'yes',
- 'allowShareDialogUserEnumeration' => 'yes',
- 'enforceLinkPassword' => false,
- 'onlyShareWithGroupMembers' => false,
- 'shareAPIEnabled' => 'yes',
- 'shareDefaultExpireDateSet' => 'no',
- 'shareExpireAfterNDays' => '7',
- 'shareEnforceExpireDate' => 'no',
- 'shareExcludeGroups' => true,
- 'shareExcludedGroupsList' => 'NoSharers|OtherNoSharers',
- 'publicShareDisclaimerText' => 'Lorem ipsum',
- 'enableLinkPasswordByDefault' => 'yes',
- 'shareApiDefaultPermissions' => Constants::PERMISSION_ALL,
- 'shareApiDefaultPermissionsCheckboxes' => $this->invokePrivate($this->admin, 'getSharePermissionList', [])
- ],
- ''
- );
-
- $this->assertEquals($expected, $this->admin->getForm());
- }
-
- public function testGetSection() {
- $this->assertSame('sharing', $this->admin->getSection());
- }
-
- public function testGetPriority() {
- $this->assertSame(0, $this->admin->getPriority());
- }
-}
diff --git a/tests/lib/Settings/ManagerTest.php b/tests/lib/Settings/ManagerTest.php
index 2b2b2250695..ed02061c595 100644
--- a/tests/lib/Settings/ManagerTest.php
+++ b/tests/lib/Settings/ManagerTest.php
@@ -21,13 +21,11 @@
*
*/
-namespace Tests\Settings;
+namespace OCA\Settings\Tests\AppInfo;
-use function get_class;
-use OC\Settings\Admin\Sharing;
+use OCA\Settings\Admin\Sharing;
use OC\Settings\Manager;
-use OC\Settings\Mapper;
-use OC\Settings\Personal\Security;
+use OCA\Settings\Personal\Security;
use OC\Settings\Section;
use OCP\IDBConnection;
use OCP\IL10N;
@@ -35,7 +33,6 @@ use OCP\ILogger;
use OCP\IServerContainer;
use OCP\IURLGenerator;
use OCP\L10N\IFactory;
-use OCP\Settings\ISettings;
use OCP\Settings\ISubAdminSettings;
use Test\TestCase;
diff --git a/tests/lib/Settings/Personal/SecurityTest.php b/tests/lib/Settings/Personal/SecurityTest.php
deleted file mode 100644
index 012c1d87a1f..00000000000
--- a/tests/lib/Settings/Personal/SecurityTest.php
+++ /dev/null
@@ -1,120 +0,0 @@
-<?php
-declare(strict_types=1);
-
-/**
- * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-namespace Test\Settings\Personal;
-
-use OC\Authentication\TwoFactorAuth\ProviderLoader;
-use OCP\IInitialStateService;
-use OCP\InitialStateService;
-use OC\Settings\Personal\Security;
-use OCP\AppFramework\Http\TemplateResponse;
-use OCP\IConfig;
-use OCP\IUser;
-use OCP\IUserManager;
-use OCP\IUserSession;
-use PHPUnit\Framework\MockObject\MockObject;
-use Test\TestCase;
-
-class SecurityTest extends TestCase {
-
- /** @var InitialStateService|MockObject */
- private $initialStateService;
-
- /** @var IUserManager|MockObject */
- private $userManager;
-
- /** @var ProviderLoader|MockObject */
- private $providerLoader;
-
- /** @var IUserSession|MockObject */
- private $userSession;
-
- /** @var IConfig|MockObject */
- private $config;
-
- /** @var string */
- private $uid;
-
- /** @var Security */
- private $section;
-
- public function setUp() {
- parent::setUp();
-
- $this->initialStateService = $this->createMock(IInitialStateService::class);
- $this->userManager = $this->createMock(IUserManager::class);
- $this->providerLoader = $this->createMock(ProviderLoader::class);
- $this->userSession = $this->createMock(IUserSession::class);
- $this->config = $this->createMock(IConfig::class);
- $this->uid = 'test123';
-
- $this->section = new Security(
- $this->initialStateService,
- $this->userManager,
- $this->providerLoader,
- $this->userSession,
- $this->config,
- $this->uid
- );
- }
-
- public function testGetForm() {
- $user = $this->createMock(IUser::class);
- $this->userManager->expects($this->once())
- ->method('get')
- ->with($this->uid)
- ->willReturn($user);
- $user->expects($this->once())
- ->method('canChangePassword')
- ->willReturn(true);
- $this->userSession->expects($this->once())
- ->method('getUser')
- ->willReturn($user);
- $this->providerLoader->expects($this->once())
- ->method('getProviders')
- ->with($user)
- ->willReturn([]);
- $this->config->expects($this->once())
- ->method('getUserValue')
- ->with(
- $this->uid,
- 'accessibility',
- 'theme',
- false
- )
- ->willReturn(false);
-
- $form = $this->section->getForm();
-
- $expected = new TemplateResponse('settings', 'settings/personal/security', [
- 'passwordChangeSupported' => true,
- 'twoFactorProviderData' => [
- 'providers' => [],
- ],
- 'themedark' => false,
- ]);
- $this->assertEquals($expected, $form);
- }
-
-}
diff --git a/tests/lib/Settings/SectionTest.php b/tests/lib/Settings/SectionTest.php
index 422b931bb4b..70606135630 100644
--- a/tests/lib/Settings/SectionTest.php
+++ b/tests/lib/Settings/SectionTest.php
@@ -21,7 +21,7 @@
*
*/
-namespace Tests\Settings;
+namespace OCA\Settings\Tests\AppInfo;
use OC\Settings\Section;
use Test\TestCase;