I have the following test:
class AuthTest extends TestCase
{
use DatabaseTransactions;
/** @test */
public function a_user_may_login()
{
$this->login()->see('Welcome back!');
}
protected function login($user = null)
{
$user = $user ?: $this->factory->create('App\User', ['password' => 'password']);
return $this->visit('login')
->type($user->email, 'email')
->type('password', 'password')
->press('Log in');
}
}
But its throwing the following error: ErrorException: Undefined property: AuthTest::$factory
Any ideas why it's throwing this error?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire