samedi 17 avril 2021

How to pass arguments to a test function in laravel throw console

Very newbie here. Apologize if i'm asking something stupid or obvious.

I'm playing around with test in Laravel, and I want to test the same function with different users I've created. Is there a way to pass the id as an argument throw laravel console? I mean, writing something like:

 /** @test */
public function my_test_function($id)
{
    $user = User::find($id);
   ..........................}

And then calling with:

php artisan test --filter my_test_function ....... plus something to pass the id.

Thanks a lot.

Aucun commentaire:

Enregistrer un commentaire