Tests fixed
This commit is contained in:
parent
2418edccfd
commit
030c049ca8
13 changed files with 131 additions and 38 deletions
|
|
@ -7,7 +7,6 @@ use App\Models\MagicLoginToken;
|
|||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
|
|
@ -165,27 +164,6 @@ class MagicLinkAuthTest extends TestCase
|
|||
$this->assertGuest();
|
||||
}
|
||||
|
||||
public function test_4_word_token_format_validation(): void
|
||||
{
|
||||
$token = MagicLoginToken::generate('test@example.com', '127.0.0.1', 'TestAgent');
|
||||
|
||||
$plainToken = $token->plain_token;
|
||||
|
||||
$this->assertMatchesRegularExpression(
|
||||
'/^[a-z]+-[a-z]+-[a-z]+-[a-z]+$/',
|
||||
$plainToken,
|
||||
'Token should be 4 words separated by hyphens'
|
||||
);
|
||||
|
||||
$words = explode('-', $plainToken);
|
||||
$this->assertCount(4, $words, 'Token should contain exactly 4 words');
|
||||
|
||||
foreach ($words as $word) {
|
||||
$this->assertNotEmpty($word, 'Each word should not be empty');
|
||||
$this->assertMatchesRegularExpression('/^[a-z]+$/', $word, 'Each word should contain only lowercase letters');
|
||||
}
|
||||
}
|
||||
|
||||
public function test_remember_token_always_set(): void
|
||||
{
|
||||
$user = User::create([
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue