I would like to test my sign up form in Laravel. I'm doing this:
$this->visit('/auth/signup/free')
->type('First Name', 'first_name')
->type('[email protected]', 'email')
->type('mypassword', 'password')
->press('Get Started');
But I have an error 500, because I then redirect the user to a welcome page which test some property of the current user, and these ones doesn't exist:
A request to [http://localhost/welcome] failed. Received status code [500].
Caused by
exception 'ErrorException' with message 'Undefined property: App\Models\User::$active' in D:\workspace\myproject\app\Models\User.php:48
Stack trace:
#0 D:\workspace\myproject\app\Models\User.php(48): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Undefined prope...', 'D:\\workspace\\my...', 48, Array)
#1 D:\workspace\myproject\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php(2670): App\Models\User->active()
[...]
The user appears in the database, but it seems that Laravel doesn't have access to any of its property.
How could I handle this?
Edit: I'm using Laravel 5.3. I have the same error than this guy: https://laracasts.com/discuss/channels/testing/51-phpunit-tests-fail-without-middleware/replies/89708