Created
January 8, 2015 17:57
-
-
Save jesseschutt/d73d078a4c7aab5f1752 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function test() | |
{ | |
$mock = Mockery::mock('Illuminate\Contracts\Auth\Guard'); | |
app()->instance('Illuminate\Contracts\Auth\Guard', $mock); | |
$this->call('POST', 'auth\login', ['email' => '[email protected]', 'password' => 'asasdsdfb']); | |
$mock->shouldReceive('attempt')->once()->andReturn('false'); | |
} | |
//within the AuthenticatesAndRegistersUsers Trait | |
public function postLogin(Request $request) | |
{ | |
$this->validate($request, [ | |
'email' => 'required', 'password' => 'required', | |
]); | |
$credentials = $request->only('email', 'password'); | |
if ($this->auth->attempt($credentials, $request->has('remember'))) | |
{ | |
return redirect()->intended($this->redirectPath()); | |
} | |
return redirect('/auth/login') | |
->withInput($request->only('email')) | |
->withErrors([ | |
'email' => 'These credentials do not match our records.', | |
]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment