コード例 #1
0
 public function test_post_reauthenticate_returns_redirect()
 {
     $user = new TestUser();
     $user->password = bcrypt('test');
     Auth::shouldReceive('user')->once()->andReturn($user);
     Session::set('url.intended', 'http://reauthenticate.app/auth/reauthenticate');
     $request = \Illuminate\Http\Request::create('http://reauthenticate.app/auth/reauthenticate', 'POST', ['password' => 'test']);
     $request->setSession(app('session.store'));
     $controller = new TestController();
     /** @var Illuminate\Http\RedirectResponse $response */
     $response = $controller->postReauthenticate($request);
     $this->assertInstanceOf(Illuminate\Http\RedirectResponse::class, $response);
     $this->assertEquals('http://reauthenticate.app/auth/reauthenticate', $response->getTargetUrl());
     $this->assertTrue(Session::has('reauthenticate.life'));
     $this->assertTrue(Session::has('reauthenticate.authenticated'));
     $this->assertTrue(Session::get('reauthenticate.authenticated'));
 }