-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Firewall->getExpirationTime() + more tests
- Loading branch information
Showing
7 changed files
with
174 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Tests\Orisai\Auth\Doubles; | ||
|
||
use Orisai\Auth\Authentication\Data\Logins; | ||
use Orisai\Auth\Authentication\LoginStorage; | ||
use function random_int; | ||
|
||
final class TestingArrayLoginStorage implements LoginStorage | ||
{ | ||
|
||
/** @var array<Logins> */ | ||
private array $logins = []; | ||
|
||
/** @var array<int> */ | ||
private array $tokens = []; | ||
|
||
public function getLogins(string $namespace): Logins | ||
{ | ||
return $this->logins[$namespace] | ||
?? ($this->logins[$namespace] = new Logins()); | ||
} | ||
|
||
public function regenerateSecurityToken(string $namespace): void | ||
{ | ||
$this->tokens[$namespace] = random_int(0, 1_000_000); | ||
} | ||
|
||
public function alreadyExists(string $namespace): bool | ||
{ | ||
return isset($this->logins[$namespace]); | ||
} | ||
|
||
public function getToken(string $namespace): int | ||
{ | ||
return $this->tokens[$namespace] | ||
?? ($this->tokens[$namespace] = random_int(0, 1_000_000)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters