mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-05 18:23:48 +00:00
added it_send_reset_link_to_email, it_reset_user_passwordtest
This commit is contained in:
@@ -133,10 +133,10 @@ return [
|
||||
|
||||
'features' => [
|
||||
Features::registration(),
|
||||
Features::resetPasswords(),
|
||||
//Features::resetPasswords(),
|
||||
// Features::emailVerification(),
|
||||
Features::updateProfileInformation(),
|
||||
Features::updatePasswords(),
|
||||
//Features::updatePasswords(),
|
||||
/*Features::twoFactorAuthentication([
|
||||
'confirmPassword' => true,
|
||||
]),*/
|
||||
|
||||
@@ -4,8 +4,11 @@ namespace Tests\Feature\Accounts;
|
||||
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use App\Notifications\ResetPassword;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Illuminate\Support\Facades\Password;
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
use Notification;
|
||||
use Storage;
|
||||
use Tests\TestCase;
|
||||
|
||||
@@ -125,4 +128,45 @@ class AuthTest extends TestCase
|
||||
$this->postJson('/logout')
|
||||
->assertStatus(204);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_send_reset_link_to_email()
|
||||
{
|
||||
Notification::fake();
|
||||
|
||||
$user = User::factory(User::class)
|
||||
->create(['email' => 'john@doe.com']);
|
||||
|
||||
$this->postJson('/api/password/email', [
|
||||
'email' => $user->email,
|
||||
])->assertStatus(200);
|
||||
|
||||
Notification::assertTimesSent(1, ResetPassword::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_reset_user_password()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['email' => 'john@doe.com']);
|
||||
|
||||
// Get password token
|
||||
$token = Password::getRepository()
|
||||
->create($user);
|
||||
|
||||
$this->postJson('/api/password/reset', [
|
||||
'token' => $token,
|
||||
'email' => $user->email,
|
||||
'password' => 'VeryStrongPassword',
|
||||
'password_confirmation' => 'VeryStrongPassword',
|
||||
])->assertStatus(200);
|
||||
|
||||
$this->assertDatabaseMissing('password_resets', [
|
||||
'email' => $user->email,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user