diff --git a/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php b/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php index a2747327bc670..e013ecf549fe0 100644 --- a/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php @@ -1,4 +1,5 @@ appManager = $this->createMock(IAppManager::class); + $this->user = $this->createMock(\OCP\IUser::class); + + $this->loader = new ProviderLoader($this->appManager); + } /** * @expectedException Exception * @expectedExceptionMessage Could not load two-factor auth provider \OCA\MyFaulty2faApp\DoesNotExist */ public function testFailHardIfProviderCanNotBeLoaded() { - $this->providerLoader->expects($this->once()) - ->method('getProviders') + $this->appManager->expects($this->once()) + ->method('getEnabledAppsForUser') ->with($this->user) - ->will($this->returnValue(['faulty2faapp'])); - $this->manager->expects($this->once()) - ->method('loadTwoFactorApp') - ->with('faulty2faapp'); - - $this->providerLoader->expects($this->once()) + ->willReturn(['mail', 'twofactor_totp']); + $this->appManager ->method('getAppInfo') - ->with('faulty2faapp') - ->will($this->returnValue([ - 'two-factor-providers' => [ - '\OCA\MyFaulty2faApp\DoesNotExist', - ], - ])); - - $this->manager->getProviderSet($this->user); + ->will($this->returnValueMap([ + ['mail', []], + ['twofactor_totp'], [ + 'two-factor-providers' => [ + '\\OCA\\MyFaulty2faApp\\DoesNotExist', + ], + ], + ])); + + $this->loader->getProviders($this->user); + } + + public function testGetProviders() { + } }