Example #1
  * @test
 public function views_should_add_message_to_container()
     $messages = new \Jgallred\Simplemessage\Messaging\Typed\Messages();
     $view = $this->factory->make('home.index');
     $this->assertEquals($messages, $view->getData()['messages']);
     $this->assertCount(2, $messages);
  * Register the view environment.
  * @return void
 public function registerFactory()
     $this->app->bindShared('view', function ($app) {
         // Next we need to grab the engine resolver instance that will be used by the
         // environment. The resolver will be used by an environment to get each of
         // the various engine implementations such as plain PHP or Blade engine.
         $resolver = $app['view.engine.resolver'];
         $finder = $app['view.finder'];
         $env = new Factory($resolver, $finder, $app['events'], $app['translator']);
         // If the session is set on the application instance, we'll inject it into
         // the factory instance. This allows the view to use the flash session to
         // get messages from the redirector
         if (isset($app['session'])) {
         // We will also set the container instance on this view environment since the
         // view composers may be classes registered in the container, which allows
         // for great testable, flexible composers for the application developer.
         $env->share('app', $app);
         return $env;