aboutsummaryrefslogtreecommitdiffstats
path: root/tests/Core/Middleware/TwoFactorMiddlewareTest.php
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2025-05-02 14:00:10 +0200
committerJoas Schilling <coding@schilljs.com>2025-05-02 16:47:42 +0200
commitc24f5fb256f53836727d3479e0fcf79d680ca2ca (patch)
tree97e2ee14c40ed1cf2237eacd26f69375235e8419 /tests/Core/Middleware/TwoFactorMiddlewareTest.php
parent9a16e4fd1407f0490136f6cfeec184be4b219dce (diff)
downloadnextcloud-server-test/noid/more-phpunit-10.tar.gz
nextcloud-server-test/noid/more-phpunit-10.zip
test: Finish migrating tests/Core/ to PHPUnit 10 compatible codetest/noid/more-phpunit-10
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/Core/Middleware/TwoFactorMiddlewareTest.php')
-rw-r--r--tests/Core/Middleware/TwoFactorMiddlewareTest.php26
1 files changed, 16 insertions, 10 deletions
diff --git a/tests/Core/Middleware/TwoFactorMiddlewareTest.php b/tests/Core/Middleware/TwoFactorMiddlewareTest.php
index 6b8bf1c76e0..2d778a740dc 100644
--- a/tests/Core/Middleware/TwoFactorMiddlewareTest.php
+++ b/tests/Core/Middleware/TwoFactorMiddlewareTest.php
@@ -234,23 +234,29 @@ class TwoFactorMiddlewareTest extends TestCase {
$this->middleware->beforeController($twoFactorChallengeController, 'index');
}
- public function dataRequires2FASetupDone() {
- $provider = $this->createMock(IProvider::class);
- $provider->method('getId')
- ->willReturn('2FAftw');
-
+ public static function dataRequires2FASetupDone(): array {
return [
- [[], false, false],
- [[], true, true],
- [[$provider], false, true],
- [[$provider], true, true],
+ [false, false, false],
+ [false, true, true],
+ [true, false, true],
+ [true, true, true],
];
}
/**
* @dataProvider dataRequires2FASetupDone
*/
- public function testRequires2FASetupDone(array $providers, bool $missingProviders, bool $expectEception): void {
+ public function testRequires2FASetupDone(bool $hasProvider, bool $missingProviders, bool $expectEception): void {
+ if ($hasProvider) {
+ $provider = $this->createMock(IProvider::class);
+ $provider->method('getId')
+ ->willReturn('2FAftw');
+ $providers = [$provider];
+ } else {
+ $providers = [];
+ }
+
+
$user = $this->createMock(IUser::class);
$this->reflector