add fake token generator

This commit is contained in:
Yisroel Baum 2026-04-24 13:23:23 +03:00
parent 07040851ec
commit 057df09dda
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9

View file

@ -0,0 +1,25 @@
<?php
namespace Tests\Fakes;
use App\Auth\TokenGenerator;
class FakeTokenGenerator implements TokenGenerator
{
private int $callCount = 0;
/**
* @param string[] $predefinedTokens
*/
public function __construct(
private array $predefinedTokens = ['fake-token-0'],
) {}
public function generate(): string
{
$index = $this->callCount % count($this->predefinedTokens);
$this->callCount++;
return $this->predefinedTokens[$index];
}
}