From c9358acf5d56be7debaea84404e35149f71f6ca1 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 28 Mar 2015 06:25:36 +0100 Subject: [PATCH] Update tests and token replace routine. --- app/Http/Middleware/ReplaceTestVars.php | 2 ++ tests/controllers/HomeControllerTest.php | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Http/Middleware/ReplaceTestVars.php b/app/Http/Middleware/ReplaceTestVars.php index 10daf84d09..3af1d24641 100644 --- a/app/Http/Middleware/ReplaceTestVars.php +++ b/app/Http/Middleware/ReplaceTestVars.php @@ -5,6 +5,7 @@ namespace FireflyIII\Http\Middleware; use Closure; use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\Routing\Middleware; +use Log; /** * Class ReplaceTestVars @@ -45,6 +46,7 @@ class ReplaceTestVars implements Middleware $input = $request->all(); $input['_token'] = $request->session()->token(); // 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); } diff --git a/tests/controllers/HomeControllerTest.php b/tests/controllers/HomeControllerTest.php index 05bd3c7550..df7d4dba6f 100644 --- a/tests/controllers/HomeControllerTest.php +++ b/tests/controllers/HomeControllerTest.php @@ -35,7 +35,7 @@ class HomeControllerTest extends TestCase $end = '2015-03-31'; $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->assertSessionHas('start'); @@ -53,7 +53,7 @@ class HomeControllerTest extends TestCase $end = '2015-03-31'; $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->assertSessionHas('start');