I'm using laravel 5.6
I'm trying to launch some tests with phpunit
.
I have a store
method like the following
public function store(Request $request , CustomModel $custom_model, Task $task )
{
$this->validate($request, [
'foo' => 'required|max:100',
'bar' => 'required|in:input,textarea,radio,select',
]);
...
So I tried to write the corresponding test, like this
$response = $this->post( route('my.route.name') , [
'foo' => '',
'bar' => 'input',
]);
But of course as I don't specify the CustomModel
and Task
, the test fail and tell me
Missing required parameters for [Route: my/route/{custom_model}/name/{task}]
And I don't know how the syntax should be in the test ...
I tried the following
$this->post( route('my.route.name' , ['custom_model' => $model , 'task' => $task]), ['foo' => '', 'bar' => 'input'] )
But I does not seems to work
Aucun commentaire:
Enregistrer un commentaire