mirror of
https://github.com/nextcloud/server.git
synced 2026-10-23 11:15:48 +02:00
There was a weird inconsistent mix of Test\, Tests\lib, Test\Core, Tests\Core and Core\. Now there is only Test\ for tests/lib/ and Tests\Core for tests/Core. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
52 lines
1.2 KiB
PHP
52 lines
1.2 KiB
PHP
<?php
|
|
|
|
/**
|
|
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: christoph
|
|
* Date: 11.10.18
|
|
* Time: 13:01
|
|
*/
|
|
|
|
namespace Test\Authentication\TwoFactorAuth;
|
|
|
|
use OC\Authentication\TwoFactorAuth\EnforcementState;
|
|
use Test\TestCase;
|
|
|
|
class EnforcementStateTest extends TestCase {
|
|
public function testIsEnforced(): void {
|
|
$state = new EnforcementState(true);
|
|
|
|
$this->assertTrue($state->isEnforced());
|
|
}
|
|
|
|
public function testGetEnforcedGroups(): void {
|
|
$state = new EnforcementState(true, ['twofactorers']);
|
|
|
|
$this->assertEquals(['twofactorers'], $state->getEnforcedGroups());
|
|
}
|
|
|
|
public function testGetExcludedGroups(): void {
|
|
$state = new EnforcementState(true, [], ['yoloers']);
|
|
|
|
$this->assertEquals(['yoloers'], $state->getExcludedGroups());
|
|
}
|
|
|
|
public function testJsonSerialize(): void {
|
|
$state = new EnforcementState(true, ['twofactorers'], ['yoloers']);
|
|
$expected = [
|
|
'enforced' => true,
|
|
'enforcedGroups' => ['twofactorers'],
|
|
'excludedGroups' => ['yoloers'],
|
|
];
|
|
|
|
$json = $state->jsonSerialize();
|
|
|
|
$this->assertEquals($expected, $json);
|
|
}
|
|
}
|