create fake implementations for auth and user repo
This commit is contained in:
parent
ee48f578be
commit
2d7ada60fd
2 changed files with 42 additions and 0 deletions
13
tests/Fakes/FakeAuthTokenizer.php
Normal file
13
tests/Fakes/FakeAuthTokenizer.php
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Fakes;
|
||||||
|
|
||||||
|
use Yisroel\DigiWill\Module\Auth\AuthTokenizer;
|
||||||
|
|
||||||
|
class FakeAuthTokenizer implements AuthTokenizer
|
||||||
|
{
|
||||||
|
public function generateToken(): string
|
||||||
|
{
|
||||||
|
return 'AuthToken';
|
||||||
|
}
|
||||||
|
}
|
||||||
29
tests/Fakes/FakeUserRepository.php
Normal file
29
tests/Fakes/FakeUserRepository.php
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Fakes;
|
||||||
|
|
||||||
|
use Yisroel\DigiWill\Domain\User;
|
||||||
|
use Yisroel\DigiWill\Repositories\UserRepository;
|
||||||
|
|
||||||
|
class FakeUserRepository implements UserRepository
|
||||||
|
{
|
||||||
|
private array $users;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->users = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function find(int $id): ?User
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findByEmail(string $email): ?User
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function save(User $user): User
|
||||||
|
{
|
||||||
|
$this->users[$user->getId()] = $user;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue