mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-08-09 05:54:34 +02:00
Update tests & minor fixes
This commit is contained in:
@ -9,6 +9,12 @@ use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Http\Controllers\Auth\ForgotPasswordController
|
||||
* @covers \App\Models\User
|
||||
* @covers \App\Http\Middleware\RejectIfDemoMode
|
||||
* @covers \App\Http\Middleware\RejectIfAuthenticated
|
||||
*/
|
||||
class ForgotPasswordControllerTest extends FeatureTestCase
|
||||
{
|
||||
/**
|
||||
@ -26,7 +32,7 @@ class ForgotPasswordControllerTest extends FeatureTestCase
|
||||
]);
|
||||
|
||||
$response->assertStatus(422)
|
||||
->assertJsonValidationErrors(['email']);
|
||||
->assertJsonValidationErrors(['email']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -39,7 +45,7 @@ class ForgotPasswordControllerTest extends FeatureTestCase
|
||||
]);
|
||||
|
||||
$response->assertStatus(422)
|
||||
->assertJsonValidationErrors(['email']);
|
||||
->assertJsonValidationErrors(['email']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -52,7 +58,7 @@ class ForgotPasswordControllerTest extends FeatureTestCase
|
||||
]);
|
||||
|
||||
$response->assertStatus(422)
|
||||
->assertJsonValidationErrors(['email']);
|
||||
->assertJsonValidationErrors(['email']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -91,4 +97,21 @@ class ForgotPasswordControllerTest extends FeatureTestCase
|
||||
|
||||
$response->assertStatus(401);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function test_submit_email_password_request_when_authenticated_returns_bad_request()
|
||||
{
|
||||
$user = User::factory()->create();
|
||||
|
||||
$this->actingAs($user, 'web-guard')
|
||||
->json('POST', '/user/password/lost', [
|
||||
'email' => $user->email,
|
||||
])
|
||||
->assertStatus(400)
|
||||
->assertJsonStructure([
|
||||
'message',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user