From c9253cce6cacedc19dbb04d8dd89a3da1473ef20 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Thu, 30 Jan 2020 13:30:45 +0100 Subject: Move personal settings to proper registration Signed-off-by: Roeland Jago Douma --- tests/lib/Settings/ManagerTest.php | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'tests') diff --git a/tests/lib/Settings/ManagerTest.php b/tests/lib/Settings/ManagerTest.php index 7972a4bdbba..06eafb6528b 100644 --- a/tests/lib/Settings/ManagerTest.php +++ b/tests/lib/Settings/ManagerTest.php @@ -24,15 +24,14 @@ namespace OCA\Settings\Tests\AppInfo; use OC\Settings\Manager; -use OC\Settings\Section; use OCA\Settings\Admin\Sharing; -use OCA\Settings\Personal\Password; use OCP\IDBConnection; use OCP\IL10N; use OCP\ILogger; use OCP\IServerContainer; use OCP\IURLGenerator; use OCP\L10N\IFactory; +use OCP\Settings\ISettings; use OCP\Settings\ISubAdminSettings; use Test\TestCase; @@ -149,21 +148,27 @@ class ManagerTest extends TestCase { } public function testGetPersonalSettings() { - $section = $this->createMock(Password::class); - $section->expects($this->once()) - ->method('getPriority') + $section = $this->createMock(ISettings::class); + $section->method('getPriority') ->willReturn(16); - $section2 = $this->createMock(Security\Authtokens::class); - $section2->expects($this->once()) - ->method('getPriority') + $section->method('getSection') + ->willReturn('security'); + $section2 = $this->createMock(ISettings::class); + $section2->method('getPriority') ->willReturn(100); + $section2->method('getSection') + ->willReturn('security'); + + $this->manager->registerSetting('personal', 'section1'); + $this->manager->registerSetting('personal', 'section2'); + $this->container->expects($this->at(0)) ->method('query') - ->with(Password::class) + ->with('section1') ->willReturn($section); $this->container->expects($this->at(1)) ->method('query') - ->with(Security\Authtokens::class) + ->with('section2') ->willReturn($section2); $settings = $this->manager->getPersonalSettings('security'); -- cgit v1.2.3