diff options
Diffstat (limited to 'tests/lib/Authentication/TwoFactorAuth/ManagerTest.php')
-rw-r--r-- | tests/lib/Authentication/TwoFactorAuth/ManagerTest.php | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php index acc0f0d3e92..0f09691bc1c 100644 --- a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php @@ -37,58 +37,59 @@ use OCP\IConfig; use OCP\ILogger; use OCP\ISession; use OCP\IUser; +use PHPUnit\Framework\MockObject\MockObject; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Test\TestCase; class ManagerTest extends TestCase { - /** @var IUser|\PHPUnit_Framework_MockObject_MockObject */ + /** @var IUser|MockObject */ private $user; - /** @var ProviderLoader|\PHPUnit_Framework_MockObject_MockObject */ + /** @var ProviderLoader|MockObject */ private $providerLoader; - /** @var IRegistry|\PHPUnit_Framework_MockObject_MockObject */ + /** @var IRegistry|MockObject */ private $providerRegistry; - /** @var MandatoryTwoFactor|\PHPUnit_Framework_MockObject_MockObject */ + /** @var MandatoryTwoFactor|MockObject */ private $mandatoryTwoFactor; - /** @var ISession|\PHPUnit_Framework_MockObject_MockObject */ + /** @var ISession|MockObject */ private $session; /** @var Manager */ private $manager; - /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */ + /** @var IConfig|MockObject */ private $config; - /** @var IManager|\PHPUnit_Framework_MockObject_MockObject */ + /** @var IManager|MockObject */ private $activityManager; - /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */ + /** @var ILogger|MockObject */ private $logger; - /** @var IProvider|\PHPUnit_Framework_MockObject_MockObject */ + /** @var IProvider|MockObject */ private $fakeProvider; - /** @var IProvider|\PHPUnit_Framework_MockObject_MockObject */ + /** @var IProvider|MockObject */ private $backupProvider; - /** @var TokenProvider|\PHPUnit_Framework_MockObject_MockObject */ + /** @var TokenProvider|MockObject */ private $tokenProvider; - /** @var ITimeFactory|\PHPUnit_Framework_MockObject_MockObject */ + /** @var ITimeFactory|MockObject */ private $timeFactory; - /** @var EventDispatcherInterface|\PHPUnit_Framework_MockObject_MockObject */ + /** @var EventDispatcherInterface|MockObject */ private $eventDispatcher; protected function setUp() { parent::setUp(); $this->user = $this->createMock(IUser::class); - $this->providerLoader = $this->createMock(\OC\Authentication\TwoFactorAuth\ProviderLoader::class); + $this->providerLoader = $this->createMock(ProviderLoader::class); $this->providerRegistry = $this->createMock(IRegistry::class); $this->mandatoryTwoFactor = $this->createMock(MandatoryTwoFactor::class); $this->session = $this->createMock(ISession::class); @@ -150,7 +151,8 @@ class ManagerTest extends TestCase { public function testIsTwoFactorAuthenticatedEnforced() { $this->mandatoryTwoFactor->expects($this->once()) - ->method('isEnforced') + ->method('isEnforcedFor') + ->with($this->user) ->willReturn(true); $enabled = $this->manager->isTwoFactorAuthenticated($this->user); @@ -160,7 +162,8 @@ class ManagerTest extends TestCase { public function testIsTwoFactorAuthenticatedNoProviders() { $this->mandatoryTwoFactor->expects($this->once()) - ->method('isEnforced') + ->method('isEnforcedFor') + ->with($this->user) ->willReturn(false); $this->providerRegistry->expects($this->once()) ->method('getProviderStates') @@ -174,7 +177,8 @@ class ManagerTest extends TestCase { public function testIsTwoFactorAuthenticatedOnlyBackupCodes() { $this->mandatoryTwoFactor->expects($this->once()) - ->method('isEnforced') + ->method('isEnforcedFor') + ->with($this->user) ->willReturn(false); $this->providerRegistry->expects($this->once()) ->method('getProviderStates') @@ -196,7 +200,8 @@ class ManagerTest extends TestCase { public function testIsTwoFactorAuthenticatedFailingProviders() { $this->mandatoryTwoFactor->expects($this->once()) - ->method('isEnforced') + ->method('isEnforcedFor') + ->with($this->user) ->willReturn(false); $this->providerRegistry->expects($this->once()) ->method('getProviderStates') |