ValidatePasswordPolicyEventTest.php 811 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace Test\Security\Events;
  8. use OCP\Security\Events\ValidatePasswordPolicyEvent;
  9. use OCP\Security\PasswordContext;
  10. class ValidatePasswordPolicyEventTest extends \Test\TestCase {
  11. public function testDefaultProperties(): void {
  12. $password = 'example';
  13. $event = new ValidatePasswordPolicyEvent($password);
  14. $this->assertEquals($password, $event->getPassword());
  15. $this->assertEquals(PasswordContext::ACCOUNT, $event->getContext());
  16. }
  17. public function testSettingContext(): void {
  18. $event = new ValidatePasswordPolicyEvent('example', PasswordContext::SHARING);
  19. $this->assertEquals(PasswordContext::SHARING, $event->getContext());
  20. }
  21. }