public function setUp()
 {
     parent::setUp();
     $this->view = $this->app['view'];
     $this->request = $this->app['request'];
     $this->request->setSession($this->app['session.store']);
     $this->validatorFactory = $this->app['validator'];
     $this->model = Mockery::mock('Illuminate\\Database\\Eloquent\\Model');
     $this->config = (include __DIR__ . '/../src/config/config.php');
     $this->formHelper = new FormHelper($this->view, $this->request, $this->config);
     $this->formBuilder = new FormBuilder($this->app, $this->formHelper);
     $this->plainForm = $this->formBuilder->plain();
 }
 public function setUp()
 {
     parent::setUp();
     $this->view = $this->app['view'];
     $this->request = $this->app['request'];
     $this->request->setSession($this->app['session.store']);
     $this->validatorFactory = $this->app['validator'];
     $this->model = new TestModel();
     $this->config = (include __DIR__ . '/../src/config/config.php');
     $this->formHelper = new FormHelper($this->view, $this->config);
     $this->formBuilder = new FormBuilder($this->app, $this->formHelper);
     $this->plainForm = $this->formBuilder->plain();
 }
 /** @test */
 public function it_can_test_the_prepare_method()
 {
     $config = m::mock('Illuminate\\Config\\Repository');
     $config->shouldReceive('get')->with('app.foo')->once()->andReturn('Foo');
     $config->shouldReceive('get')->with('app.bar')->once()->andReturn('Bar');
     $config->shouldReceive('get')->with('app.baz')->once()->andReturn('Baz');
     $request = new Request();
     $session = m::mock('Illuminate\\Session\\Store');
     $session->shouldReceive('getOldInput')->once()->with('foo', 'Foo')->andReturn('Foo');
     $session->shouldReceive('getOldInput')->once()->with('bar', 'Bar')->andReturn('Bar');
     $session->shouldReceive('getOldInput')->once()->with('baz', 'Baz')->andReturn('Baz');
     $request->setSession($session);
     $sectionPrepare = new SectionPrepare($config, $request);
     $section = new Section('foo', function ($s) {
         $s->fieldset('foo', function ($f) {
             $f->field('foo', function ($f) {
                 $f->config = 'app.foo';
             });
             $f->field('bar', function ($f) {
                 $f->config = 'app.bar';
             });
             $f->field('baz', function ($f) {
                 $f->config = 'app.baz';
             });
         });
         $s->fieldset('bar');
         $s->fieldset('baz');
     });
     $sectionPrepare->prepare($section);
     $this->assertEquals('Foo', $section->fieldset('foo')->field('foo')->value);
     $this->assertEquals('Bar', $section->fieldset('foo')->field('bar')->value);
     $this->assertEquals('Baz', $section->fieldset('foo')->field('baz')->value);
 }
Example #4
0
 /**
  * @cover \Ohio\Core\User\Http\Controllers\LoginController::__construct
  * @cover \Ohio\Core\User\Http\Controllers\LoginController::showLoginForm
  * @cover \Ohio\Core\User\Http\Controllers\LoginController::logout
  */
 public function test()
 {
     # __construct
     $controller = new LoginController();
     # showLoginForm
     $view = $controller->showLoginForm();
     $this->assertInstanceOf(View::class, $view);
     # logout
     $request = new Request();
     $request->setSession($this->getTestSession());
     $response = $controller->logout($request);
     $this->assertInstanceOf(RedirectResponse::class, $response);
 }
Example #5
0
 /**
  * Sets the Session.
  *
  * @param \Symfony\Component\HttpFoundation\SessionInterface $session The Session
  * @static 
  */
 public static function setSession($session)
 {
     //Method inherited from \Symfony\Component\HttpFoundation\Request
     return \Illuminate\Http\Request::setSession($session);
 }
Example #6
0
 /**
  * Prepare the request by injecting any services.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Request
  */
 public function prepareRequest(Request $request)
 {
     if (!is_null($this['config']['session.driver']) && !$request->hasSession()) {
         $request->setSession($this['session']->driver());
     }
     return $request;
 }