dimanche 11 août 2019

fail at submiting 2d array into unit test laravel

i have an api that recives 3 inputs as below :

room_id[]
from_date
to_date

now room id is an array of ids for room my test for this api is like below :

  $response = $this->json('POST', '/api/v1/accommodationbookingapi', [array(['room_id' => '1']),'from_date' =>'2019-04-2','to_date'=>'2019-04-2']);
        dd($response);`

and the message of that dd is like below :

  "message" => "Argument 1 passed to Illuminate\Database\Query\Builder::cleanBindings() must be of the type array, null given, called in /home/farshad/my-projects/tika_acco/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php on line 870"

i have tested that in post man and thats working fine but test seems like it does not recognize the room_id array that i am sending to it . so as input how can send an array to api ??

Aucun commentaire:

Enregistrer un commentaire