예제 #1
0
 /**
  * Setup the test environment.
  */
 public function setUp()
 {
     parent::setUp();
     $this->mock_url = Mockery::mock('\\Illuminate\\Routing\\UrlGenerator')->shouldIgnoreMissing();
     $this->mock_session = Mockery::mock('\\Illuminate\\Session\\Store')->shouldIgnoreMissing();
     $this->mock_translator = Mockery::mock('\\Illuminate\\Translation\\Translator')->shouldIgnoreMissing();
     $this->redirector = new Redirector($this->mock_url, $this->mock_translator);
     $this->redirector->setSession($this->mock_session);
 }
 /**
  * Register the Redirector service.
  *
  * @return void
  */
 protected function registerRedirector()
 {
     $this->app['redirect'] = $this->app->share(function ($app) {
         $redirector = new Redirector($app['url'], $app['translator']);
         // If the session is set on the application instance, we'll inject it into
         // the redirector instance. This allows the redirect responses to allow
         // for the quite convenient "with" methods that flash to the session.
         if (isset($app['session.store'])) {
             $redirector->setSession($app['session.store']);
         }
         return $redirector;
     });
 }