Level 5
D'oh, as always I figured out minutes after posting this.
For anyone else, it needs changed to this
$user = User::factory()->create([
'password' => bcrypt($password = 'i-love-laravel'),
]);
Summer Sale! All accounts are 50% off this week.
When running tests I get this:
1) Tests\Feature\LoginTest::test_user_can_login_with_correct_credentials
Error: Call to undefined function Tests\Feature\factory()
The test looks like this:
public function test_user_can_login_with_correct_credentials()
{
$user = factory(User::class)->create([
'password' => bcrypt($password = 'i-love-laravel'),
]);
$response = $this->post('/login', [
'email' => $user->email,
'password' => $password,
]);
$response->assertRedirect('/dashboard');
$this->assertAuthenticatedAs($user);
}
But this is being flagged with the error:
Undefined function 'factory'
I am using L9
Any ideas?
D'oh, as always I figured out minutes after posting this.
For anyone else, it needs changed to this
$user = User::factory()->create([
'password' => bcrypt($password = 'i-love-laravel'),
]);
Please or to participate in this conversation.