Skip to content

Commit

Permalink
Change the way a too many login attempts message is asserted against (#…
Browse files Browse the repository at this point in the history
…21)

* Change the way a too many login attempts message is asserted against
* Removed unused import
  • Loading branch information
DCzajkowski authored Jul 12, 2019
1 parent 60b0a97 commit 99f00b6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use App\User;
use Tests\TestCase;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Notification;
use Illuminate\Auth\Notifications\VerifyEmail;
use Illuminate\Foundation\Testing\RefreshDatabase;
Expand Down
12 changes: 9 additions & 3 deletions src/Console/stubs/tests/Feature/Auth/LoginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ protected function guestMiddlewareRoute()
return route('home');
}

protected function getTooManyLoginAttemptsMessage()
{
return sprintf('/^%s$/', str_replace('\:seconds', '\d+', preg_quote(__('auth.throttle'), '/')));
}

public function testUserCanViewALoginForm()
{
$response = $this->get($this->loginGetRoute());
Expand Down Expand Up @@ -163,9 +168,10 @@ public function testUserCannotMakeMoreThanFiveAttemptsInOneMinute()

$response->assertRedirect($this->loginGetRoute());
$response->assertSessionHasErrors('email');
$this->assertContains(
'Too many login attempts.',
collect($response
$this->assertRegExp(
$this->getTooManyLoginAttemptsMessage(),
collect(
$response
->baseResponse
->getSession()
->get('errors')
Expand Down

0 comments on commit 99f00b6

Please sign in to comment.