- $this->visit('/login')->click('Forgot Password?')
- ->seePageIs('/password/email')
- ->type('barry@admin.com', 'email')
- ->press('Send Reset Link')
- ->see('A password reset link will be sent to barry@admin.com if that email address is found in the system.')
- ->dontSee('We can\'t find a user');
-
-
- $this->visit('/password/reset/arandometokenvalue')
- ->see('Reset Password')
- ->submitForm('Reset Password', [
- 'email' => 'barry@admin.com',
- 'password' => 'randompass',
- 'password_confirmation' => 'randompass'
- ])->followRedirects()
- ->seePageIs('/password/reset/arandometokenvalue')
- ->dontSee('We can\'t find a user')
- ->see('The password reset token is invalid for this email address.');
+ $this->get('/password/email');
+ $resp = $this->followingRedirects()->post('/password/email', [
+ 'email' => 'barry@admin.com',
+ ]);
+ $resp->assertSee('A password reset link will be sent to barry@admin.com if that email address is found in the system.');
+ $resp->assertDontSee('We can\'t find a user');
+
+ $this->get('/password/reset/arandometokenvalue')->assertSee('Reset Password');
+ $resp = $this->post('/password/reset', [
+ 'email' => 'barry@admin.com',
+ 'password' => 'randompass',
+ 'password_confirmation' => 'randompass',
+ 'token' => 'arandometokenvalue',
+ ]);
+ $resp->assertRedirect('/password/reset/arandometokenvalue');
+
+ $this->get('/password/reset/arandometokenvalue')
+ ->assertDontSee('We can\'t find a user')
+ ->assertSee('The password reset token is invalid for this email address.');