nextcloud/tests/lib/Security/Events/ValidatePasswordPolicyEventTest.php
Ferdinand Thiessen 127cacdd19
feat(Security): Allow setting password context for validation and generation
Co-authored-by: Ferdinand Thiessen <opensource@fthiessen.de>
Co-authored-by: Joas Schilling <213943+nickvergessen@users.noreply.github.com>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2024-08-22 19:16:50 +02:00

28 lines
799 B
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace Test\Security\Events;
use OCP\Security\Events\ValidatePasswordPolicyEvent;
use OCP\Security\PasswordContext;
class ValidatePasswordPolicyEventTest extends \Test\TestCase {
public function testDefaultProperties() {
$password = 'example';
$event = new ValidatePasswordPolicyEvent($password);
$this->assertEquals($password, $event->getPassword());
$this->assertEquals(PasswordContext::ACCOUNT, $event->getContext());
}
public function testSettingContext() {
$event = new ValidatePasswordPolicyEvent('example', PasswordContext::SHARING);
$this->assertEquals(PasswordContext::SHARING, $event->getContext());
}
}