Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
freost committed Oct 4, 2024
1 parent 0fb1683 commit 2399d89
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/mako/application/cli/commands/app/preloader/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
53 changes: 53 additions & 0 deletions tests/unit/gatekeeper/LoginStatusTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

/**
* @copyright Frederic G. Østby
* @license http://www.makoframework.com/license
*/

namespace mako\tests\unit\gatekeeper;

use mako\gatekeeper\LoginStatus;
use mako\tests\TestCase;

/**
* @group unit
*/
class LoginStatusTest extends TestCase
{
/**
*
*/
public function testLoginStatus(): void
{
$this->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());
}
}

0 comments on commit 2399d89

Please sign in to comment.