Update tests and token replace routine.

This commit is contained in:
James Cole 2015-03-28 06:25:36 +01:00
parent ed29eb8a5d
commit c9358acf5d
2 changed files with 4 additions and 2 deletions

View File

@ -5,6 +5,7 @@ namespace FireflyIII\Http\Middleware;
use Closure; use Closure;
use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\Routing\Middleware; use Illuminate\Contracts\Routing\Middleware;
use Log;
/** /**
* Class ReplaceTestVars * Class ReplaceTestVars
@ -45,6 +46,7 @@ class ReplaceTestVars implements Middleware
$input = $request->all(); $input = $request->all();
$input['_token'] = $request->session()->token(); $input['_token'] = $request->session()->token();
// we need to update _token value to make sure we get the POST / PUT tests passed. // we need to update _token value to make sure we get the POST / PUT tests passed.
Log::debug('Input token replaced ('.$input['_token'].').');
$request->replace($input); $request->replace($input);
} }

View File

@ -35,7 +35,7 @@ class HomeControllerTest extends TestCase
$end = '2015-03-31'; $end = '2015-03-31';
$this->be(new FireflyIII\User); $this->be(new FireflyIII\User);
$this->call('POST', '/daterange', ['end' => $end, 'start' => $start]); $this->call('POST', '/daterange', ['end' => $end, 'start' => $start,'_token' => 'replaceme']);
$this->assertResponseOk(); $this->assertResponseOk();
$this->assertSessionHas('start'); $this->assertSessionHas('start');
@ -53,7 +53,7 @@ class HomeControllerTest extends TestCase
$end = '2015-03-31'; $end = '2015-03-31';
$this->be(new FireflyIII\User); $this->be(new FireflyIII\User);
$this->call('POST', '/daterange', ['end' => $end, 'start' => $start]); $this->call('POST', '/daterange', ['end' => $end, 'start' => $start,'_token' => 'replaceme']);
$this->assertResponseOk(); $this->assertResponseOk();
$this->assertSessionHas('start'); $this->assertSessionHas('start');