diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2016-06-14 01:06:25 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2016-06-14 01:06:25 +0200 |
commit | ae02685e6f31d9922dbfeb758f41556369e55864 (patch) | |
tree | cb14b4fe9374bf7d7448f4326758a7a428b6e335 /tests | |
parent | d0e4727ecdc317e65be5705cbbbeb61793aa9a03 (diff) | |
parent | 990ac34aaa707652614820848e6b740763936831 (diff) | |
download | nextcloud-server-ae02685e6f31d9922dbfeb758f41556369e55864.tar.gz nextcloud-server-ae02685e6f31d9922dbfeb758f41556369e55864.zip |
Merge branch 'master' of https://github.com/owncloud/core into downstream-160614
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Authentication/TwoFactorAuth/ManagerTest.php | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php index 9a3426eda2d..363229b01bc 100644 --- a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php @@ -85,11 +85,32 @@ class ManagerTest extends TestCase { ])); } + /** + * @expectedException \Exception + * @expectedExceptionMessage Could not load two-factor auth provider \OCA\MyFaulty2faApp\DoesNotExist + */ + public function testFailHardIfProviderCanNotBeLoaded() { + $this->appManager->expects($this->once()) + ->method('getEnabledAppsForUser') + ->with($this->user) + ->will($this->returnValue(['faulty2faapp'])); + + $this->appManager->expects($this->once()) + ->method('getAppInfo') + ->with('faulty2faapp') + ->will($this->returnValue([ + 'two-factor-providers' => [ + '\OCA\MyFaulty2faApp\DoesNotExist', + ], + ])); + + $this->manager->getProviders($this->user); + } + public function testIsTwoFactorAuthenticated() { $this->prepareProviders(); - $user = $this->getMock('\OCP\IUser'); - $user->expects($this->once()) + $this->user->expects($this->once()) ->method('getUID') ->will($this->returnValue('user123')); $this->config->expects($this->once()) @@ -97,7 +118,7 @@ class ManagerTest extends TestCase { ->with('user123', 'core', 'two_factor_auth_disabled', 0) ->will($this->returnValue(0)); - $this->assertTrue($this->manager->isTwoFactorAuthenticated($user)); + $this->assertTrue($this->manager->isTwoFactorAuthenticated($this->user)); } public function testGetProvider() { |