diff options
Diffstat (limited to 'tests/lib/Authentication/TwoFactorAuth')
6 files changed, 16 insertions, 16 deletions
diff --git a/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php b/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php index 2402fcf9f7b..67eb27cfdee 100644 --- a/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php @@ -41,7 +41,7 @@ class ProviderUserAssignmentDaoTest extends TestCase { /** @var ProviderUserAssignmentDao */ private $dao; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->dbConn = OC::$server->getDatabaseConnection(); diff --git a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php index e836e8d316b..63d0e993f3b 100644 --- a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php @@ -87,7 +87,7 @@ class ManagerTest extends TestCase { /** @var EventDispatcherInterface|MockObject */ private $eventDispatcher; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->user = $this->createMock(IUser::class); diff --git a/tests/lib/Authentication/TwoFactorAuth/MandatoryTwoFactorTest.php b/tests/lib/Authentication/TwoFactorAuth/MandatoryTwoFactorTest.php index 61ffb404dd9..92d072608f2 100644 --- a/tests/lib/Authentication/TwoFactorAuth/MandatoryTwoFactorTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/MandatoryTwoFactorTest.php @@ -45,7 +45,7 @@ class MandatoryTwoFactorTest extends TestCase { /** @var MandatoryTwoFactor */ private $mandatoryTwoFactor; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->config = $this->createMock(IConfig::class); diff --git a/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php b/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php index 55a1e173928..f3762976837 100644 --- a/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php @@ -43,7 +43,7 @@ class ProviderLoaderTest extends TestCase { /** @var ProviderLoader */ private $loader; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->appManager = $this->createMock(IAppManager::class); @@ -52,11 +52,11 @@ class ProviderLoaderTest extends TestCase { $this->loader = new ProviderLoader($this->appManager); } - /** - * @expectedException Exception - * @expectedExceptionMessage Could not load two-factor auth provider \OCA\MyFaulty2faApp\DoesNotExist - */ + public function testFailHardIfProviderCanNotBeLoaded() { + $this->expectException(\Exception::class); + $this->expectExceptionMessage('Could not load two-factor auth provider \\OCA\\MyFaulty2faApp\\DoesNotExist'); + $this->appManager->expects($this->once()) ->method('getEnabledAppsForUser') ->with($this->user) diff --git a/tests/lib/Authentication/TwoFactorAuth/ProviderManagerTest.php b/tests/lib/Authentication/TwoFactorAuth/ProviderManagerTest.php index 736dfdb913b..e34d844c3a4 100644 --- a/tests/lib/Authentication/TwoFactorAuth/ProviderManagerTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/ProviderManagerTest.php @@ -47,7 +47,7 @@ class ProviderManagerTest extends TestCase { /** @var ProviderManager */ private $providerManager; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->providerLoader = $this->createMock(ProviderLoader::class); @@ -59,10 +59,10 @@ class ProviderManagerTest extends TestCase { ); } - /** - * @expectedException \OC\Authentication\Exceptions\InvalidProviderException - */ + public function testTryEnableInvalidProvider() { + $this->expectException(\OC\Authentication\Exceptions\InvalidProviderException::class); + $user = $this->createMock(IUser::class); $this->providerManager->tryEnableProviderFor('none', $user); } @@ -105,10 +105,10 @@ class ProviderManagerTest extends TestCase { $this->assertTrue($res); } - /** - * @expectedException \OC\Authentication\Exceptions\InvalidProviderException - */ + public function testTryDisableInvalidProvider() { + $this->expectException(\OC\Authentication\Exceptions\InvalidProviderException::class); + $user = $this->createMock(IUser::class); $this->providerManager->tryDisableProviderFor('none', $user); } diff --git a/tests/lib/Authentication/TwoFactorAuth/RegistryTest.php b/tests/lib/Authentication/TwoFactorAuth/RegistryTest.php index ad29377e559..2f59d14992a 100644 --- a/tests/lib/Authentication/TwoFactorAuth/RegistryTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/RegistryTest.php @@ -45,7 +45,7 @@ class RegistryTest extends TestCase { /** @var Registry */ private $registry; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->dao = $this->createMock(ProviderUserAssignmentDao::class); |