In my Unit Test in Laravel I am setting the currently authenticated user with the code below. This is exactly how Laravel documented it on their website. I use the default User model which Laravel provide.
public function testLoggedInUserCanCreateCat() {
Route::enableFilters();
$user = new User(array(
'name' => 'john'
));
$this->be($user);
$this->call('GET', '/cats/create');
$this->assertResponseOk();
}
For some reason, when I run phpunit in SSH, I get the following error:
1) GlobalTest::testLoggedInUserCanCreateCat
Illuminate\Database\Eloquent\MassAssignmentException: name
Does anyone know whats goes wrong here? I searched for a couple of hours on the internet, but couldn't find any help..