Laravel csrf validation failing during unit testing (Laravel 4.1)

I recently upgraded from Laravel 4.0 to 4.1 following the upgrade instructions, and now when unit testing my csrf tokens will not validate. I have posted code here: http://laravel.io/bin/7qRx

The csrf validation seems to work fine when browsing the site and submitting forms, however when I run the unit tests to validate the same forms, the csrf validation fails. It worked before the upgrade to 4.1.

I found a similar problem here, but also no solution listed. https://github.com/laravel/laravel/issues/2633

Any ideas?

Answers


I found the solution. You have to add

Session::start();

to the setup() method. Solves session related problems when you call the routes.

Apparently Laravel starts the session when the route is called, and if it hasn't already been created, the previous session data is overwritten.

Found the solution based on what was posted here: Laravel 4 testing session in controllers [SOLVED]


Need Your Help

Should I have to have an x86 and a x64 version of my java application?

java windows osx 32bit-64bit launch4j

Just a quick question. I want to bundle a JRE with my Java application using launch4j, but so far it is seeming that I need to bundle the application on a 64 bit machine and a 32 bit machine for some

Haskell gtk2hs closing aboutDialogs

haskell gtk2hs

I'm having some trouble with the close buttons of aboutDialogs in gtk2hs. Here is my code

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.