ReyesHatrinak's avatar

test artisan command laravel 9

I'm trying to write a test command in Laravel 9. In the below code the new user will create successfully But after creating need to redirect the Dashboard page

public function test_an_action_that_requires_authentication() { $user = $this->artisan('make:user',[ 'name' => "username", 'email' => "useremail", 'password' => Str::random(8) ]); } How to redirect to the route after success created

0 likes
2 replies
SilenceBringer's avatar

@reyeshatrinak what do you mean need to redirect the Dashboard page? in test?

Maybe you want to visit the page and check if user redirected to ligin page? Like

$this->get('/dashboard')
	->assertRedirect('login');
Sinnbeck's avatar

Artisan command and redirect? One is CLI and the other is HTTP. How are they related?

Please or to participate in this conversation.