From 2399d8977cd6f7e6f9bcfd7b124030842a169c05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederic=20G=2E=20=C3=98stby?= Date: Fri, 4 Oct 2024 17:37:09 +0200 Subject: [PATCH] Added tests --- .../cli/commands/app/preloader/core.php | 1 + tests/unit/gatekeeper/LoginStatusTest.php | 53 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 tests/unit/gatekeeper/LoginStatusTest.php diff --git a/src/mako/application/cli/commands/app/preloader/core.php b/src/mako/application/cli/commands/app/preloader/core.php index f743633f1..3d6677dfb 100644 --- a/src/mako/application/cli/commands/app/preloader/core.php +++ b/src/mako/application/cli/commands/app/preloader/core.php @@ -91,6 +91,7 @@ mako\gatekeeper\entities\user\MemberInterface::class, mako\gatekeeper\entities\user\UserEntityInterface::class, mako\gatekeeper\Gatekeeper::class, + mako\gatekeeper\LoginStatus::class, mako\gatekeeper\repositories\group\GroupRepositoryInterface::class, mako\gatekeeper\repositories\user\UserRepositoryInterface::class, mako\http\Request::class, diff --git a/tests/unit/gatekeeper/LoginStatusTest.php b/tests/unit/gatekeeper/LoginStatusTest.php new file mode 100644 index 000000000..5b1957a88 --- /dev/null +++ b/tests/unit/gatekeeper/LoginStatusTest.php @@ -0,0 +1,53 @@ +assertSame(1, LoginStatus::OK->value); + $this->assertSame(2, LoginStatus::BANNED->value); + $this->assertSame(3, LoginStatus::NOT_ACTIVATED->value); + $this->assertSame(4, LoginStatus::INVALID_CREDENTIALS->value); + $this->assertSame(5, LoginStatus::LOCKED->value); + } + + /** + * + */ + public function testGetCode(): void + { + $this->assertSame(1, LoginStatus::OK->getCode()); + $this->assertSame(2, LoginStatus::BANNED->getCode()); + $this->assertSame(3, LoginStatus::NOT_ACTIVATED->getCode()); + $this->assertSame(4, LoginStatus::INVALID_CREDENTIALS->getCode()); + $this->assertSame(5, LoginStatus::LOCKED->getCode()); + } + + /** + * + */ + public function testToBool(): void + { + $this->assertTrue(LoginStatus::OK->toBool()); + $this->assertFalse(LoginStatus::BANNED->toBool()); + $this->assertFalse(LoginStatus::NOT_ACTIVATED->toBool()); + $this->assertFalse(LoginStatus::INVALID_CREDENTIALS->toBool()); + $this->assertFalse(LoginStatus::LOCKED->toBool()); + } +}